我用delphi7 , ado ,mysql连接数据库
在家里可以写数据库
在公司里只要一写数据库就出现
project project1.exe raised exception class EOLeException with message '[mysql][odbc 3.51 Driver][mysqld-3.23.57]you have an error in your SQL syntax near';'guest_name'='xiaomin' at line 1'.
process stopped.Use Step or Run to continue.这是怎么回事啊?

解决方案 »

  1.   

    你的sql语句有问题。帖出来看看
      

  2.   

    公司里的数据库和你家里的数据库不一样(表的字段或数据),所以出现语句错误。you have an error in your SQL syntax near';'guest_name'='xiaomin' at line 1'.
    =======================
    可能是SQL语句的问题
      

  3.   

    代码绝对没有错误。
    adotable1.Open;
    adotable1.Append;
    adotable1.FieldByName('guest_num').AsInteger:=strtoint(edit1.text);
    adotable1.FieldByName('guest_name').AsString:=edit2.Text;
    adotable1.Post;
    运行可以
    但是一提交就出现如下警告:project project1.exe raised exception class EOLeException with message '[mysql][odbc 3.51 Driver][mysqld-3.23.57]you have an error in your SQL syntax near';guest('guest_num','guest_name'),values('22','xiaomin') at line 1'.
    process stopped.Use Step or Run to continue.
    在家里就可以 啊,数据类型和家里完全一样
      

  4.   

    用sql语句
    update,insert,delete
      

  5.   

    adotable1.Open;
    adotable1.Append;
    adotable1.FieldByName('guest_num').NewValue:=strtoint(edit1.text);
    adotable1.FieldByName('guest_name').NewValue:=edit2.Text;
    adotable1.Post;
      

  6.   

    就是,可以肯定数据库中'guest_name'字段类型不一样
      

  7.   

    以后别用adotable用adoquery直接执行sql语句,又灵活又高效!费不了多少事!