title: executing sql command from vb.net
body: <p>This is my code in <code>VB.Net</code>. I am doing connectivity from <code>vb10</code> to oracle 10g. Ghe problem is my code is working fine in <code>sql prompt</code> as </p>
  
  <pre><code>SQL&gt; insert into product values(pid_inc(),'name',' desc ',101,'"c:\imgloc','brand ',1,10)
  </code></pre>
  
  <p>but when I try to access it from vb it stops working. Why is that?
  My vb code is:</p>
  
  <pre><code>Dim con As New OleDb.OleDbConnection("Provider=MSDAORA.1;User ID=jon;password=snow;Data Source=KAUSTUBH-PC;Persist Security Info=False")
  con.Open()
  name = TextBox1.Text
  desc = TextBox2.Text
  price = Val(TextBox3.Text)
  available = Val(TextBox4.Text)
  brand = TextBox5.Text
  cat = ComboBox1.Text
  
  If (name &lt;&gt; "") Then
      nameflg = True
  Else
      nameflg = False
      MsgBox(" product name cannot be empty")
  End If
  
  If (available &gt; 0) Then
      availableflg = True
  Else
      availableflg = False
      MsgBox("quantity cannot be 0")
  End If
  
  If (brand &lt;&gt; "") Then
      brandflg = True
  Else
      brandflg = False
      MsgBox(" insert brand name")
  End If
  
  If (cat &lt;&gt; "") Then
      catflg = True
  Else
      catflg = False
      MsgBox("pleaese select categoty")
  End If
  If (nameflg And logoflg And brandflg And catflg And availableflg) Then
      query = "Select cat_id from category where cat_name='" + cat + "'"
      Dim cmd As New OleDb.OleDbCommand(query, con)
      x = cmd.ExecuteScalar().ToString
      cat_id = Val(x)
      query = "insert into product values(pid_inc(),'" &amp; name &amp; "','" &amp; desc &amp; "'," &amp; price &amp; ",'" &amp; imgloc &amp; "','" &amp; brand &amp; "'," &amp; cat_id &amp; "," &amp; available &amp; ")"
      Dim cmd1 As New OleDb.OleDbCommand(query, con)
      cat_id = cmd1.ExecuteNonQuery()
      If (cat_id = 0) Then
          MsgBox("Record not inserted properly ....try again")
      Else
          MsgBox("Record inserted successfully")
      End If
  'Else
  '   MsgBox("please fill the fields properly")
  End If
  
  End Sub
  </code></pre>