Project project1.exe raised exception class EDatabaseError with message ‘query1: no sql statement available’.process stopped.use step or run to continue.我是个新手,请高手帮帮忙吧··

解决方案 »

  1.   

    你的SQL语句是无效的,检查Query1的SQL部分内容,或者把它放到BDE中看看是否能够运行!
      

  2.   

    SQL语句错误,在调试模式下把SQL的语句复制出来张贴到SQL查询分析器里边运行下就可以找出错误
      

  3.   

      把你sql语句单独执行一下,如果对的话会不会是控件连接没设置对
      

  4.   

    Query1.SQL.Add('select * from flight where FlightNo=:s0 and StrDate=:StrDate');
        Query1.ParamByName('s0').AsString :=Edit1.Text ;
        Query1.ParamByName('StrDate').AsDateTime :=strtodate(edit2.Text );
        Query1.Open ;
    if query1.RecNo =0 then
            begin
               application.MessageBox('此航班不存在!','提示信息',mb_ok)
            end
            else begin
                Query1.RequestLive :=true;
                DBgrid1.Fields[0].DisplayLabel :='航班号';
                DBgrid1.Fields[1].DisplayLabel :='起飞日期';
                DBgrid1.Fields[2].DisplayLabel :='起飞时间';
                DBgrid1.Fields[3].DisplayLabel :='起飞城市';
                DBgrid1.Fields[4].DisplayLabel :='到达日期';
                DBgrid1.Fields[5].DisplayLabel :='到达时间';
                DBgrid1.Fields[6].DisplayLabel :='到达城市';
             end;
    end;
      

  5.   

    上面就是这部分的代码,大家帮忙看哈,有没有可能是在DATABASE里面创建的数据库文件有问题啊
      

  6.   

    with query1 do
      begin
        query1.Close;
        query1.SQL.Clear;
        Query1.SQL.Add('select * from flight where FlightNo=:s0 and StrDate=:StrDate'); 
        Query1.ParamByName('s0').AsString :=Edit1.Text ; 
        Query1.ParamByName('StrDate').AsDateTime :=strtodate(edit2.Text ); 
        Query1.Open ; 
      end;
       ...
      

  7.   

    单步调试时错误提示 datasource1:circular datalinks are not allowed
      

  8.   

    project project1.exe raised exception class EDBEngineError with message 'invalid use of keyword
    Token:order
    Line number:1'process stopped.use step or run to continue.
    这又是怎么回事啊,郁闷了!!
      

  9.   

    数据库是什么,database联接数据库正常吗
    还有没有其它的代码“'invalid use of keyword ”这提示的是关键字错误
     Query1.ParamByName('s0').AsString :=Edit1.Text ; 
     Query1.ParamByName('StrDate').AsDateTime :=strtodate(edit2.Text ); 
    改成
     Query1.ParamByName('s0').value:=Edit1.Text ; 
     Query1.ParamByName('StrDate').value:=strtodate(edit2.Text ); 
    试试
      

  10.   

    没用database 啊,数据文件在database desktop里面  用datasource和tuery组件连的数据
      

  11.   

    unit flightquery;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Grids, DBGrids, DB, DBTables;type
      TFliQuery = class(TForm)
        Label1: TLabel;
        Label2: TLabel;
        Edit1: TEdit;
        Edit2: TEdit;
        DataSource1: TDataSource;
        Query1: TQuery;
        DBGrid1: TDBGrid;
        ButtonYes: TButton;
        ButtonExit: TButton;
        procedure ButtonExitClick(Sender: TObject);
        procedure ButtonYesClick(Sender: TObject);
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      FliQuery: TFliQuery;implementation{$R *.dfm}procedure TFliQuery.ButtonExitClick(Sender: TObject);
    begin
    Query1.Close;
    end;procedure TFliQuery.ButtonYesClick(Sender: TObject);
    begin
        DBgrid1.DataSource :=datasource1;
        DBgrid1.ReadOnly :=true;
        datasource1.DataSet :=Query1;
        Query1.SQL.Clear ;
        //先查询数据库,看看所指定的航班存不存在
        Query1.SQL.Add('select * from flight where FlightNo=:s0 and StrDate=:StrDate');
        Query1.ParamByName('s0').AsString :=Edit1.Text ;
        Query1.ParamByName('StrDate').AsDateTime :=strtodate(edit2.Text );
        Query1.Open ;
        if query1.RecNo =0 then
            begin
               application.MessageBox('此航班不存在!','提示信息',mb_ok)
            end
            else begin
                Query1.RequestLive :=true;
                DBgrid1.Fields[0].DisplayLabel :='航班号';
                DBgrid1.Fields[1].DisplayLabel :='起飞日期';
                DBgrid1.Fields[2].DisplayLabel :='起飞时间';
                DBgrid1.Fields[3].DisplayLabel :='起飞城市';
                DBgrid1.Fields[4].DisplayLabel :='到达日期';
                DBgrid1.Fields[5].DisplayLabel :='到达时间';
                DBgrid1.Fields[6].DisplayLabel :='到达城市';
             end;
    end;//初始化工作,设定默认值
    procedure TFliQuery.FormCreate(Sender: TObject);
    begin
    edit1.Text :='fly';
    edit2.Text :='2009-09-09';
    end;end.这是航班查询模块的全部代码,其他模块的跟这差不多,不知道哪里错了,麻烦高手看下啊
      

  12.   

    你把AsString和AsDateTime改成Value
    如果还不行,你直接写SQL语句吧,不要用Param
    比如
    query1.sql.add(format('select * from flight where flightno=''%s''',[Edit1.text]));
    单引号不行改双引号另,最好先做query1.close;
      

  13.   

    procedure TFliQuery.ButtonYesClick(Sender: TObject); 
    begin 
        DBgrid1.DataSource :=datasource1; 
        DBgrid1.ReadOnly :=true; 
        datasource1.DataSet :=Query1; 
        Query1.Close; //++++++++++++++++++++++++++
        Query1.SQL.Clear ; 
        //先查询数据库,看看所指定的航班存不存在 
        Query1.SQL.Add('select * from flight where FlightNo=:s0 and StrDate=:StrDate');
        Query1.Parameters.ParamByName('s0').Value:=Edit1.Text ; 
        Query1.Parameters.ParamByName('StrDate').Value:=strtodate(edit2.Text ); 
        Query1.Open ; 
        if query1.RecNo =0 then 
            begin 
              application.MessageBox('此航班不存在!','提示信息',mb_ok) 
            end 
            else begin 
                Query1.RequestLive :=true; 
                DBgrid1.Fields[0].DisplayLabel :='航班号'; 
                DBgrid1.Fields[1].DisplayLabel :='起飞日期'; 
                DBgrid1.Fields[2].DisplayLabel :='起飞时间'; 
                DBgrid1.Fields[3].DisplayLabel :='起飞城市'; 
                DBgrid1.Fields[4].DisplayLabel :='到达日期'; 
                DBgrid1.Fields[5].DisplayLabel :='到达时间'; 
                DBgrid1.Fields[6].DisplayLabel :='到达城市'; 
            end; 
    end; 
    這樣試試?
      

  14.   

    有错误号吗?有的话,这个可以给你帮助:http://download.csdn.net/source/1469205