title: Prepared Statements For ODBC in VB.net
body: <p>my question is a pretty simple one, however I simply cannot see where i have gone wrong.</p>
  
  <p>I just want to know how to create a prepared statement in VB. I know in java one would use ? and these would get replaced. I am aware that in VB you use @ParameterName. Basically my code gets down to where i use the prepare method and the error i get is that my syntax for my insert is incorrect. To me it seems that the parameter is not getting substituted in the insert statement</p>
  
  <p>Eg. </p>
  
  <pre><code>Dim cmd As String = "insert into sites(id) values(@id)"
  Dim odcmd As New OdbcCommand
  
  odcmd.CommandText = cmd
  
  odcmd.Parameters.Add("@id", OdbcType.Int)
  odcmd.Parameters("@id").Value = 5
  
  con.Open()
  odcmd.Prepare()
  odcmd.ExecuteNonQuery()
  con.Close()
  </code></pre>
  
  <p>Any help?</p>