cmd.Parameters.Add("ID", SqlDbType.NVarChar, 50).Value = TextBox1.Text cmd.Parameters.Add("@ID", SqlDbType.NVarChar, 50).Value = TextBox1.Text
cn.Open() Dim sqlQuery As String = "INSERT INTO [Table] ( [ID], [Name], [code/address], [(Tel)] ) " & _ "VALUES ( @ID, @Name, @code_name, @Tel )" Using cmd As New SqlCommand(sqlQuery, cn) cmd.Parameters.Add("ID", SqlDbType.NVarChar, 50).Value = TextBox1.Text cmd.Parameters.Add("Name", SqlDbType.NVarChar, 50).Value = TextBox2.Text cmd.Parameters.Add("code_name", SqlDbType.NVarChar, 50).Value = TextBox3.Text cmd.Parameters.Add("Tel", SqlDbType.NVarChar, 50).Value = TextBox4.Text cmd.ExecuteNonQuery() End Using cn.Close() cn.Dispose()