M mynlxx Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-23 #2 FindInFiels里找crSQLWait,一个都找不到?
J jrq Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-23 #3 执行SQL语句的时候,默认为crSQLWait的 这样设 Screen.Cursor:= crHourGlass; 试试看看行否~~
B bubble Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-24 #5 不知道你在说什么,不过用线程后台查询 是解决问题的根本办法,而不是什么改变鼠标形状。 type TQueryThread = class(TThread) //FSession: TSession; FQuery: TADOQuery; FDataSource: TDataSource; FQueryException: Exception; procedure ConnectDataSource; procedure ShowQryError; protected procedure Execute; override; public constructor Create(Query: TADOQuery; DataSource: TDataSource);virtual; end; var Form1: TForm1; implementation {$R *.DFM} procedure RunBackgroundQuery(Query: TADOQuery;DataSource: TDataSource); begin TQueryThread.Create(Query,DataSource); end; procedure TForm1.Button1Click(Sender: TObject); begin try Query1.Close; Query1.SQL.Clear; Query1.SQL.Add('select * from users order by ID'); RunBackgroundQuery(Query1, DataSource1); except end; end; { TQueryThread } procedure TQueryThread.ConnectDataSource; begin FDataSource.DataSet := FQuery; end; constructor TQueryThread.Create( Query: TADOQuery; DataSource: TDataSource); begin inherited Create(True); FQuery := Query; FDataSource := DataSource; FreeOnTerminate := True; Resume; end; procedure TQueryThread.Execute; begin try FQuery.Open; Synchronize(ConnectDataSource); except FQueryException := ExceptObject as Exception; Synchronize(ShowQryError); end; end; procedure TQueryThread.ShowQryError; begin Application.ShowException(FQueryException); end;
不知道你在说什么,不过用线程后台查询 是解决问题的根本办法,而不是什么改变鼠标形状。 type TQueryThread = class(TThread) //FSession: TSession; FQuery: TADOQuery; FDataSource: TDataSource; FQueryException: Exception; procedure ConnectDataSource; procedure ShowQryError; protected procedure Execute; override; public constructor Create(Query: TADOQuery; DataSource: TDataSource);virtual; end; var Form1: TForm1; implementation {$R *.DFM} procedure RunBackgroundQuery(Query: TADOQuery;DataSource: TDataSource); begin TQueryThread.Create(Query,DataSource); end; procedure TForm1.Button1Click(Sender: TObject); begin try Query1.Close; Query1.SQL.Clear; Query1.SQL.Add('select * from users order by ID'); RunBackgroundQuery(Query1, DataSource1); except end; end; { TQueryThread } procedure TQueryThread.ConnectDataSource; begin FDataSource.DataSet := FQuery; end; constructor TQueryThread.Create( Query: TADOQuery; DataSource: TDataSource); begin inherited Create(True); FQuery := Query; FDataSource := DataSource; FreeOnTerminate := True; Resume; end; procedure TQueryThread.Execute; begin try FQuery.Open; Synchronize(ConnectDataSource); except FQueryException := ExceptObject as Exception; Synchronize(ShowQryError); end; end; procedure TQueryThread.ShowQryError; begin Application.ShowException(FQueryException); end;
P proman Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-24 #6 直接的方法是没有啦,因为执行Sql的时候,程序里面是改变的屏幕的光标,除非你用其它方法 能截获这个事件,然后才能想办法处理,在Delphi里估记是不可能的.