private void button1_Click(object sender, EventArgs e)
{
//验证提交
OleDbConnection con = DB.creatOleCon();
con.Open();
OleDbCommand cmd1 = DB.creatOleComd("select * from xtbgznr where 文件编号='" + textBox2.Text + "'", con);
if (!UserInfo.judgeUserid(con, cmd1) || UserInfo.文件编号 == textBox2.Text.Trim())
{
MessageBox.Show("此文件不存在!");
}
else
{
string update = string.Format("update xtbgznr set 工作内容='{0}',文件编号='{1}'where 文件编号='{2}'", richTextBox1.Text, textBox2.Text, UserInfo.文件编号);
OleDbCommand cmd = DB.creatOleComd(update, con);
if (DB.Insert(cmd))
{
MessageBox.Show("添加成功!");
}
else
{
MessageBox.Show("添加失败!");
}
}
}
查了下应该是xtbgznr . 工作内容未DBNull.value造成的,但是应该怎么解决呀,没看明白度娘的,应该怎么修改呀
{
//验证提交
OleDbConnection con = DB.creatOleCon();
con.Open();
OleDbCommand cmd1 = DB.creatOleComd("select * from xtbgznr where 文件编号='" + textBox2.Text + "'", con);
if (!UserInfo.judgeUserid(con, cmd1) || UserInfo.文件编号 == textBox2.Text.Trim())
{
MessageBox.Show("此文件不存在!");
}
else
{
string update = string.Format("update xtbgznr set 工作内容='{0}',文件编号='{1}'where 文件编号='{2}'", richTextBox1.Text, textBox2.Text, UserInfo.文件编号);
OleDbCommand cmd = DB.creatOleComd(update, con);
if (DB.Insert(cmd))
{
MessageBox.Show("添加成功!");
}
else
{
MessageBox.Show("添加失败!");
}
}
}
查了下应该是xtbgznr . 工作内容未DBNull.value造成的,但是应该怎么解决呀,没看明白度娘的,应该怎么修改呀
if(update !=DB.NULL)
{
OleDbCommand cmd = DB.creatOleComd(update, con);
if (DB.Insert(cmd))
{
MessageBox.Show("添加成功!");
}
else
{
MessageBox.Show("添加失败!");
}
}
DBNULL.Value