我将不胜感激您的回答。我如何向消息框添加按钮?明确地说,我有一个按钮,当我按下保存按钮时,我会收到一个带有以下文本的消息框:“请...”以及这两个按钮,取消和继续。
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Please fill all..."); // I like to add to this messagebox buttons
{
SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=VirtualSalesFair;Integrated Security=True");
con.Open();
SqlCommand sc = new SqlCommand("Insert into Empty value('" + textBox1.Text + "'," + textBox2.Text + ",'" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" +textBox9.Text +"',"+textBox10.Text +");", con);
int o=sc.ExecuteNonQuery();
MessageBox.Show(o+ ":Record has been inserted");
con.Close();
}
}