What's my mistake?
using (SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\admin\Мои документы\Visual Studio 2010\Projects\BLR\BLR\bin\Debug\Database1.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")) { conn.Open(); using (SqlCommand com = conn.CreateCommand()) { com.CommandText = "INSERT INTO TableStudents VALUES (@Name, @Education)"; com.Parameters.AddWithValue("@Name", 1); com.Parameters.AddWithValue("@Education", 2); //com.CommandText = string.Format("INSERT INTO TableStudents (Name, Education)"); //com.Parameters.Add("Name", SqlDbType.Int).Value = 1; //com.Parameters.Add("Education", SqlDbType.Int).Value = 2; temp = com.ExecuteNonQuery(); } conn.Close(); return temp; } with the SELECT command, this construct works, with INSERT in no way ... what to do, please tell me
INSERT INTO [TableStudents] (Name, Education) VALUES (@Name, @Education)try - Dmitry Chistik