C#连接ACCESS数据库的程序中出现"标准表达式中数据类型不匹配。"怎么处理?
想实现一个删除信息的按钮功能出现这个问题希望大牛帮助解答谢谢!stringCString="Provider=Microsoft.Jet.OLEDB.4.0;DataSo...
想实现一个删除信息的按钮功能 出现这个问题 希望大牛帮助解答 谢谢!
string CString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student manager.mdb";
string xuehao = "delete from 学生信息 where 学号='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
OleDbConnection myCon = new OleDbConnection(CString);
myCon.Open();
OleDbCommand MyCom1 = new OleDbCommand();
MyCom1.Connection = myCon;
MyCom1.CommandType = CommandType.Text;
//检索删除是否成功
try
{
MyCom1.CommandText = xuehao;
int j = MyCom1.ExecuteNonQuery();
if (j >= 1)
{
MessageBox.Show("删除成功!");
}
}
catch (OleDbException OleDb)
{
MessageBox.Show(OleDb.Message, "删除失败!");
} 展开
string CString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student manager.mdb";
string xuehao = "delete from 学生信息 where 学号='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'";
OleDbConnection myCon = new OleDbConnection(CString);
myCon.Open();
OleDbCommand MyCom1 = new OleDbCommand();
MyCom1.Connection = myCon;
MyCom1.CommandType = CommandType.Text;
//检索删除是否成功
try
{
MyCom1.CommandText = xuehao;
int j = MyCom1.ExecuteNonQuery();
if (j >= 1)
{
MessageBox.Show("删除成功!");
}
}
catch (OleDbException OleDb)
{
MessageBox.Show(OleDb.Message, "删除失败!");
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询