private void button1_Click(object sender, EventArgs e){SqlConnection c = new SqlConnection(Properties .Settings .Default .mainConnectionString );c.Open();string s = "insert into menu(編號(hào),名稱,價(jià)目(元))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 回答
- 0 關(guān)注
- 582 瀏覽
添加回答
舉報(bào)
0/150
提交
取消