ClientDataSet.CommandText implementation issues

Category: Delphi -> Network Author: shijiuwo123 Date: 2008-03-20 18:02:57
 
shijiuwo123
2008-03-20 18:02:57
Procedures for the MIDAS, the middle layer using Ado, SocketConnection connection with the client.

My clients want to select or update operations, but they are nothing but report:
'qry_Oper: Cannot perform this operation on an open dataset '
(qry_Oper for me in the middle tier using AdoQuery control name.)

has confirmed that the intermediate layer qry_Oper of SQL is empty, Active is False,
DataSetProvider the poAllowCommandText to True.

operation failed! I do not know what reason? Thank you advice!
with ClientDataSet do / / select
begin
; Close;
CommandText : = 'select * from User');
Open;
end;
OR
with ClientDataSet do / / update
begin
Close;
CommandText: = 'Update User set Password =''' + edt_Password.Text
; +'' ', Ime ='' '+ cb_Ime.Text +''' where AutoID = '+ IntToStr (gs_UserInfo.UserID);
; Execute;
end;
fenghuadz2
2008-03-20 18:21:12
I suspect may be your client for the first time opened, the middle layer qry_Oper has been in open position
zxb2603
2008-03-20 18:34:30
set the Options property poAllowCommandText TDataSetProvider is True;
yangtytyx
2008-03-20 18:37:35
"set the Options property poAllowCommandText TDataSetProvider is True"
set yet
q157463148
2008-03-20 18:45:30
operation in the foreground so I'm afraid not, you can write a function to pass your SQL statement middleware,
such as: (middleware type library increased a function SetSQL and add a parameter strsql type BSTR)
then write code (why not ADODataSet it, it is assumed ADODataSet1 named ds_Oper)
ds_Oper.commandtext: = strsql;

in the foreground call
with ClientDataSet do / / select
; begin
Close;
SocketConnection. Appserver.SetSQL ('select * from User');
Open;
end;
try it, certainly not the general topic!

anchna
2008-03-20 19:01:13
solve the problem, instead of setting the problem, but the controls out of the middle layer the problem.

Thank you!