SqlCommand cmd1 = new SqlCommand(sql, conn);
if (cmd1.ExecuteScalar() == null)
{
MessageBox.Show("查无资料,请输入");
button1.Enabled = true;
return;
}
else
{
textBox1.Text = cmd1.ExecuteScalar().ToString();
button5.Enabled = true;
button3.Enabled = true;
}
2)添加信息
if (textBox1.Text == "")
{
MessageBox.Show("请输入投诉信息");
return;
}
else
{
sqlConnect();
string sq2 = "insert into tousu values('" + comboBox1.Text.Trim() + "','" + textBox1.Text.Trim() + "' )";
SqlCommand cmd2 = new SqlCommand(sq2, conn);
cmd2.ExecuteNonQuery();
sqlClose();
MessageBox.Show("添加成功");
}
3)修改信息
if (textBox1.Text =="")
{
MessageBox.Show("请输入投诉信息");
return;
}
else
{
sqlConnect();
string sq4 = "update tousu set liyou='" + textBox1.Text.Trim() + "'where custormid='" + comboBox1.Text + "'";
SqlCommand cmd4 = new SqlCommand(sq4, conn); ASP.NET客户信息管理系统的开发(14):http://www.751com.cn/jisuanji/lunwen_460.html