with  fdm.ClientDataSet17 do
   begin
      Close;
      fdm.ClientDataSet17.CommandText:=  'select * from 部门指标评价 where (年度='+cxComboBox1.Text+') 
      and (月度='+cxComboBox2.Text+')and (部门KPI代码='''+FDM.ClientDataSet8.FieldByName('部门KPI代码').AsString+''')';
      Open;
    end;clientdataset17现在打不开了,不能再CXGRID里显示出来,我是通过ADO链接的数据库,在同一情况下,clientdataset1.open是正常的, 什么情况?

解决方案 »

  1.   

    寫成類似以下的方式呢
      begin
        try
          if not Assigned(RES_LOADING_F) then
            RES_LOADING_F:=TRES_LOADING_F.Create(Self);
          RES_LOADING_F.Label1.Caption:='正在讀取數據......';
          RES_LOADING_F.Show;
          Screen.Cursor:=crSQLWait;
          Application.ProcessMessages;
          qry_lzdetail.Close;
          qry_lzdetail.SQL.Clear;
          qry_lzdetail.SQL.Add( ' select * from ( select Account_Id,Full_Name,CB,BM,KB,XB,BC,JCRQ,LWS,SF,JN, ' );
          qry_lzdetail.SQL.Add( ' DATEPART(WK,DATEADD(DAY,-1,lzr)) as WEEKS from Res_Hrd_Temp where JN=''離職'' ' );
          qry_lzdetail.SQL.Add( ' ) a where WEEKS='+ Trim(u)+' and BM='''+ Trim(c)+''' ' );
          qry_lzdetail.Open;
        finally
          Screen.Cursor:=crDefault;
          FreeAndNil(RES_LOADING_F);
        end;
      end;