title: Converting string to integer VB.NET
body: <p>I'm having trouble finding the right format for converting my txtID and txtCatID into integers since it's in numbers in the database access.</p>
  <h3>Code</h3>
  <pre><code>Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles btnSave.Click
  
      Dim sqlinsert As String
  
      sqlinsert = _
          &quot;INSERT INTO Products (ProductID, Product, UnitPrice, CategoryName, CategoryID)&quot; &amp; _
          &quot; VALUES (@ProductID, @Product, @UnitPrice, @CategoryName, @CategoryID)&quot;
      Dim cmd As New OleDb.OleDbCommand(sqlinsert, con1)
  
      cmd.Parameters.Add(New OleDbParameter(&quot;@ProductID&quot;, (txtID.Text)))
      cmd.Parameters.Add(New OleDbParameter(&quot;@Product&quot;, txtProd.Text))
      cmd.Parameters.Add(New OleDbParameter(&quot;@UnitPrice&quot;, txtPrice.Text))
      cmd.Parameters.Add(New OleDbParameter(&quot;@CategoryName&quot;,txtCategory.Text))
      cmd.Parameters.Add(New OleDbParameter(&quot;@CategoryID&quot;, (txtCatID.Text)))
  
      con1.Open()
      cmd.ExecuteNonQuery()
      con1.Close()
  
      ClearTextBox(Me)
      RefreshDGV()
      Me.Close()
  </code></pre>