title: how can i add parameter to insert command in vb.net code
body: <p>I have two tables and the form contains a text box so I need to add rows of Table 1 to Table 2 and taking the value in the text box for each row is added to Table 2.</p>
  
  <p>i have insert syntax but it is need to modification:</p>
  
  <pre><code>INSERT INTO table2(column3,column4) 
  SELECT column1 + @parameter 
  FROM table1 
  WHERE column2=true
  </code></pre>
  
  <p>table1: column1 column2</p>
  
  <p>table2: column3 column4</p>
  
  <p>Form1: it have textbox1</p>
  
  <p>the full code :</p>
  
  <pre><code>Dim con As New OleDbConnection
  Dim cmd As New OleDbCommand
  Try
      con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\DellXPS\Desktop\mDB.accdb"
  
      con.Open()
      cmd.Connection = con
      cmd.CommandText = "INSERT INTO table2(column3,column4) SELECT column1 + @parameter FROM table1 WHERE column2=true"
  
      cmd.Parameters.Add("@parameter",  OleDbType.VarChar).Value = TextBox1.Text
      cmd.ExecuteNonQuery()
  Catch ex As Exception
      MessageBox.Show("Error while inserting record on table..." &amp; ex.Message, "Insert Records")
  Finally
      con.Close()
  End Try
  </code></pre>
  
  <p>i think the wrong in insert syntax ,, hop to corrected  </p>