利用本身的连接功能,最后代码如下:
string execd="delete from user where id=2";
this.oleDbConnection1.Open();
this.oleDbDeleteCommand1=new OleDbCommand(execd,this.oleDbConnection1);
this.oleDbDeleteCommand1.ExecuteNonQuery();
this.oleDbConnection1.Close();
MessageBox.Show("ok");我想问题是在access连接上或者安全,但搜索很久不行

解决方案 »

  1.   

    from子句语法错误。
    at system.data.oledb.oledbcommand.executecommandtexterrorhandling(Int32 hr)
    at system.........................executecommandtextforsingleresult(tagdbparams dbparams,object&executeresult)
    ...........
      

  2.   

    user 是关键字delete from [user] where id=2
      

  3.   

    user不能作为表名在Access 2003 里,最好不用一特殊性的名子与表名如User , NAME,PASSWORD不然会出错尽管sql语没有错误
      

  4.   

    你可以這樣:
    string execd="delete from [user] where id=2";
    this.oleDbConnection1.Open();
    this.oleDbDeleteCommand1=new OleDbCommand(execd,this.oleDbConnection1);
    this.oleDbDeleteCommand1.ExecuteNonQuery();
    this.oleDbConnection1.Close();
    MessageBox.Show("ok");如果這樣還不行請把user表名換一個名字比如userInfo就可以了
      

  5.   

    user不能作为表名
    在Access 2003 里,最好不用一特殊性的名子与表名
    如User , NAME,PASSWORD
    不然会出错完全正确,改表名
      

  6.   

    string execd="delete from [user] where id=2";
      

  7.   

    tnnd
    我怎么会犯这样的笨错误
    害的我装了一遍office,结果现在老说初始化字符串不符合oledb规定