大家好,我刚刚开始用delphi,有很多不懂得,望大家多多帮助。谢谢了先!!在TQuery中为什么在设置SQL属性,并且加参数以后,requestLive属性就不能设为true了?否则就会提示“找不到对象”!!比如:
query1.sql.clear;
query1.sql.add('select * from table where id=:id');
query1.ParamByName('id').AsInteger := 1;这时如果
query1.requestLive := true;
query1.open时就会出错??!!
而如果
query1.requestLive := false;
query1.open就没问题。
这是为什么啊???

解决方案 »

  1.   

    我运用query的参数属性进行数据库操作,没有问题阿!!
    procedure TForm1.Button1Click(Sender: TObject);
    begin
    query1.SQL.Text:='select * from employee where empno=:id';
    query1.ParamByName('id').AsInteger:=20;
    query1.Open;
    end;
    而且requestlive是否是true或者false都没问题阿!!
    找不到对象,你看看你的表里面有没有id这个字段阿!!
    我使用delphi 7进行数据库操作阿!!
      

  2.   

    我这边只要requestLive为true就说找不到对象,不知为什么????!!!
      

  3.   

    我刚刚试了试,竟然发现delphi在设置TQuery的requestLive为true之后,对数据库对象竟然大小写敏感!!!
    也就是说数据库里TABLE和ID是大写,也必须在SQL里写成大写才行!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      

  4.   

    没关系,原来这样阿,我也学习一下阿,原来requestlive之后,对大小写敏感的阿!!
      

  5.   

    函数名: getx 
    功  能: 返回当前图形位置的x坐标 
    用  法: int far getx(void); 
    程序例: #include <graphics.h> 
    #include <stdlib.h> 
    #include <stdio.h> 
    #include <conio.h> int main(void) 

       /* request auto detection */ 
       int gdriver = DETECT, gmode, errorcode; 
       char msg[80];    /* initialize graphics and local variables */ 
       initgraph(&gdriver, &gmode, "");    /* read result of initialization */ 
       errorcode = graphresult(); 
       if (errorcode != grOk)  /* an error occurred */ 
       { 
          printf("Graphics error: %s\n", grapherrormsg(errorcode)); 
          printf("Press any key to halt:"); 
          getch(); 
          exit(1); /* terminate with an error code */ 
       }    /* move to the screen center point */ 
       moveto(getmaxx() / 2, getmaxy() / 2);    /* create a message string */ 
       sprintf(msg, "<-(%d, %d) is the here.", getx(), gety());    /* display the message */ 
       outtext(msg);    /* clean up */ 
       getch(); 
       closegraph(); 
       return 0; 

      
      函数名: gety 
    功  能: 返回当前图形位置的y坐标 
    用  法: int far gety(void); 
    程序例: #include <graphics.h> 
    #include <stdlib.h> 
    #include <stdio.h> 
    #include <conio.h> int main(void) 

       /* request auto detection */ 
       int gdriver = DETECT, gmode, errorcode; 
       char msg[80];    /* initialize graphics and local variables */ 
       initgraph(&gdriver, &gmode, "");    /* read result of initialization */ 
       errorcode = graphresult(); 
       if (errorcode != grOk)  /* an error occurred */ 
       { 
          printf("Graphics error: %s\n", grapherrormsg(errorcode)); 
          printf("Press any key to halt:"); 
          getch(); 
          exit(1); /* terminate with an error code */ 
       }    /* move to the screen center point */ 
       moveto(getmaxx() / 2, getmaxy() / 2);    /* create a message string */ 
       sprintf(msg, "<-(%d, %d) is the here.", getx(), gety());    /* display the message */ 
       outtext(msg);    /* clean up */ 
       getch(); 
       closegraph(); 
       return 0;