private void button1_Click(object sender, EventArgs e){SqlConnection c = new SqlConnection(Properties .Settings .Default .mainConnectionString );c.Open();string s = "insert into menu(编号,名称,价目(元))values('"+textBox1 .Text .ToString ()+"'+'"+textBox2 .Text .ToString ()+"'+'"+textBox3 .Text .ToString ()+"')";SqlCommand cm = new SqlCommand(s,c);//cm.CommandText = s;//cm.Connection = c;int q= cm.ExecuteNonQuery();if (q == 1) { MessageBox.Show("添加成功"); }else { MessageBox.Show("添加失败"); }c.Close();}
1 回答
- 1 回答
- 0 关注
- 565 浏览
添加回答
举报
0/150
提交
取消