How to give ADO.NET Parameters
问题 I want to create a SQL command that adds record to DB. I tried the following code but it doesn't seem to be working: SqlCommand comand = new SqlCommand("INSERT INTO Product_table Values(@Product_Name,@Product_Price,@Product_Profit,@p)", connect); SqlParameter ppar = new SqlParameter(); ppar.ParameterName = "@Product_Name"; ppar.Value = textBox1.Text; MessageBox.Show("Done"); comaand.Parameters.Add(ppar); 回答1: In your case, it looks like you're using .NET. Using parameters is as easy as: C#