Keep in mind that "As" is not an operator.
This gets a little confusing becuase of the syntax shortcuts allowed by VS.Net. As stated above, the second line is the one to use because it makes "insert_log" a recognized SqlClient.SqlCommand object, rather than just a generic object. It might however be helpful to see that this is actually two lines of code which have been combined:
Dim insert_log as SqlClient.SqlCommand insert_log = New SqlClient.SqlCommand("spINSERT_log", Conn_log)
You would really only want to use the two individual lines if they did not reside in the same procedure. You might declare your object at the class level so that it is available to other procedures, and only instantiate it in a procedure when needed. |