Really quick question, which I can't find an answer too online.
I am rewriting some code, and I am noticing this sort of pattern:
SQL
TryUsingConn=GetConnect()UsingSQLQuery=Conn.CreateCommandSQLCommandText="UPDATE Blah Blah Blah"SQLQuery.Parameters.AddWithValue("@Test",SqlDbType.NVarChar).value=TestConn.Open()SQLQuery.ExecuteNonQuery()EndUsingEndUsingCatchFinallyEndTry
Is there a reason to specify CommandText and Parameters before Conn.Open()?
Because sometimes I notice this pattern, but then there is a second CommandText specified after the ExecuteNonQuery() obviously. But with this in mind, does it matter where you specify CommandText and Parameters in relation to Conn.Open()?
Also while I've got your ear...
What is the "proper" syntax when issuing a command to an SQL Database via VB.NET.