{
MessageBox.Show("请输入完整的商品信息", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
sql = "select * from product where number=" + "'" + textBox5.Text.Trim() + "'";
adapter = new SqlDataAdapter(sql, con);
adapter.Fill(dataset, "product");
if (dataset.Tables["product"].Rows.Count == 1)
{ MessageBox.Show("要添加的商品已存在", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); showproduct(); }
else
{
sql = string.Format(@"insert into product(number,name,model,category,amount,price,location,maintenance,date,mark)
values('{0}','{1}',{2},'{3}','{4}','{5}','{6}','{7}','{8}','{9}')", textBox5.Text.Trim(),
textBox6.Text.Trim(), textBox7.Text.Trim(), textBox8.Text.Trim(), textBox9.Text.Trim(),
textBox24.Text.Trim(), textBox25.Text.Trim(), textBox26.Text.Trim(), dateTimePicker1.Value, textBox27.Text.Trim());
SqlCommand cmd = new SqlCommand(sql, con);
try
{
con.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("添加成功", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
showproduct();
}
catch { }
finally ERP销售管理销售合同子模块的设计与开发(10):http://www.751com.cn/jisuanji/lunwen_2204.html