1. 首页
  2. 编程语言
  3. C#
  4. C#厨卫信息管理系统

C#厨卫信息管理系统

上传者: 2021-05-03 10:52:18上传 MSI文件 464KB 热度 11次
string name = textBox1.Text; string xh = textBox2.Text; string gl = textBox3.Text; string cd = textBox4.Text; int jg = Int32.Parse(textBox5.Text); int sl = Int32.Parse(textBox6.Text); if (name == "" || xh == "" || gl == "" || cd == "" || jg == null || sl == null) { MessageBox.Show("请输入所有商品信息!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { SqlConnection conn = new SqlConnection(s); try { conn.Open(); string sql = "insert into ApplianceInfo values('" + name + "','" + xh + "','" + gl + "','" + cd + "','" + jg + "','" + sl + "')"; SqlCommand x = new SqlCommand(sql, conn); int y = x.ExecuteNonQuery(); if (y == 1) { MessageBox.Show("保存成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; } } } private void button1_Click(object sender, EventArgs e) { textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; }
用户评论