How to pass variable into SqlCommand statement and insert into database table
问题 I'm writing a small program in C# that uses SQL to store values into a database at runtime based on input by the user. The only problem is I can't figure out the correct Sql syntax to pass variables into my database. private void button1_Click(object sender, EventArgs e) { int num = 2; using (SqlCeConnection c = new SqlCeConnection( Properties.Settings.Default.rentalDataConnectionString)) { c.Open(); string insertString = @"insert into Buildings(name, street, city, state, zip, numUnits)