您好,欢迎访问一九零五行业门户网

如何判断ACCESS数据表中的某条记录是否存在

判断 方法为: oledbconnectioncon=newoledbconnection(连接字符串); stringname=test; con.open(); oledbcommandcmd=newoledbcommand(selectcount(*)fromstudentdetailswheresname='name',con); intcount=convert.toint32(cmd.executescalar()); con.close(
判断方法为:
oledbconnection con=new oledbconnection(连接字符串);
string name=test;
con.open();
oledbcommand cmd=new oledbcommand(select count(*) from studentdetails where sname='+name+',con);
int count=convert.toint32(cmd.executescalar());
con.close();
if (count>0)
{
  //说明记录存在..
}
else
{
  //说明记录不存在..
}
其它类似信息

推荐信息