这是一个没有返回集的SQL语1句。
所以不能用OPEN。
没有返回集的SQL语句执行只能用execSql.

query1.open;
换成
query1.execSql
就OK了。

解决方案 »

  1.   

    所谓返回集就是你的SQL语句执行以后能得到一个数据集,通常就是select。
      

  2.   

    to chons(忧伤阿根廷) (
    大哥,我试了,还是不行,仍然提示期待select,update等等,怎么回事呀,另外我用的是access库,字段的类型那样设置对吗?
      

  3.   


    query1.open;
    换成
    query1.execSql
    就OK了。
      

  4.   

    to 所有的高手
    大哥,我试了,还是不行,仍然提示期待select,update等等,怎么回事呀,另外我用的是access库,字段的类型那样设置对吗?
      

  5.   

    create table :nm 
    (gqdm integer null,
     gqmc string null,
     savepath string null,
     yypath string null);
    你的是不是少了一对句号???????????????
      

  6.   

    你这样用可能不对, ParamByName 一般用于SQL操作语句,如Select,Insert,Delete,Update,不用于SQL控制语句,如Create,Drop,Alert等,至少我没有这样用过,你可以这样用
      query1.close;
      query1.sql.Text := Format('create table %s (gqdm integer null,gqmc varchar(10) null,savepath varchar(20) null,yypath varchar(2) null)' , [trim(edit1.text)]);
      query1.ExecSQL;还有,String 型可能不能用,改为varchar吧, 很少有数据库会直接用String这样的数据类型,虽然char和varchar实际上都是string, 但很少显示地标识为string
      

  7.   

    当然错了!
    先要执行query1.ExecSQL;
    执行储存过程要先
    query1.Prepare;
    query1.ExecProc;
      

  8.   

    你别光说什么select update之类的呀,完整的提示贴出来看看
      

  9.   

    var 
      TempSQL:string;
        .
        .
        .
      TempSQL:=format(' create %s (gqdm integer null, gqmc VARCHAR null,savepath VARCHAR null,yypath VARCHAR null )',[trim(edit1.text);]);
      query1.close;
      query1.sql.clear;
      query1.sql.add(TempSQL);
      query1.ExecSQL;
    你的错误:1,query1.open;改为query1.ExecSQL;2,create 表命令格式错3。ACCESS的字符长类型是VARCHAR 而不是string
    另外,我建议你用delphi的sql explore跟踪程序,好多错误好查出原因来
    你试试可以上面的办法
      

  10.   

    query1.close;
      query1.sql.clear;
      query1.sql.add('create table :nm (gqdm integer null,gqmc string null,savepath string null,yypath string null)' );
      query1.ParamByName('nm').asstring:= trim(edit1.text);
      query1.execsql;
      

  11.   

    query1.close;
      query1.sql.clear;
      query1.sql.add('create table :nm (gqdm integer null,gqmc string null,savepath string null,yypath string null)' );
      query1.ParamByName('nm').asstring:= trim(edit1.text);
      query1.execsql;
      

  12.   

    query1.close;
      query1.sql.clear;
      query1.sql.add('create table :nm (gqdm integer null,gqmc string null,savepath string null,yypath string null)' );
      query1.ParamByName('nm').asstring:= trim(edit1.text);
      query1.execsql;