 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jak Guest
|
Posted: Thu Mar 29, 2007 8:11 am Post subject: Catastrophic failure with COM+ client |
|
|
Hi, all,
I ran into 'Catastrophic failure' with my COM+ client app when passing the
query sql string to the procedure on COM+ server app, on the server app,
there is a datamodule containing ADOQuery component to fetch recordset from
the SQL Server Express 2005, both the server and client applications are on
the same computer.
Here are my code snippets:
//server side
{
dm : instance of class(TDataModule)
cn: TADOConnection;
qry: TADOQuery;
dspQuery: TDataSetProvider;
}
function TCOMTest.GetRemoteRecordset(const strQuery: WideString;
var RetVal: OleVariant): OleVariant;
begin
with dm do
begin
try
qry.Close;
qry.SQL.Clear;
qry.SQL.Add(strQuery);
qry.Open;
RetVal := dspQuery.Data;
SetComplete;
except
SetAbort;
end;
end;
Result := 1;
end;
//client side
//clCOM:TClientDataSet;
var
d:OleVariant ;
svr:ICOMTest ;
begin
svr :=CoCOMTest.CreateRemote('127.0.0.1');
strQuery := 'Select top ' + IntToStr(len) +
' * from Lcustomers where customerid like ''' + bgn + '%'';';
svr.GetRemoteRecordset(strQuery ,d);
clCOM.Data :=d;
......
end;
What's wrong with my codes?
Thanks,
Jak |
|
| Back to top |
|
 |
Jak Guest
|
Posted: Thu Mar 29, 2007 1:09 pm Post subject: Invalid Data Packet error |
|
|
I made a slight modification on the codes on server side, the dm would be
created dynamically when executing TCOMTest.GetRemoteRecordset, the
Catastrophic failure disappeared, but another exception 'Invalid Data
Packet' was threwn out. How to handle it?
Jak
"Jak" <NO-spam_cnlohmann (AT) yeah (DOT) net> wrote in message
news:460b330e (AT) newsgroups (DOT) borland.com...
| Quote: | Hi, all,
I ran into 'Catastrophic failure' with my COM+ client app when passing the
query sql string to the procedure on COM+ server app, on the server app,
there is a datamodule containing ADOQuery component to fetch recordset
from the SQL Server Express 2005, both the server and client applications
are on the same computer.
Here are my code snippets:
//server side
{
dm : instance of class(TDataModule)
cn: TADOConnection;
qry: TADOQuery;
dspQuery: TDataSetProvider;
}
function TCOMTest.GetRemoteRecordset(const strQuery: WideString;
var RetVal: OleVariant): OleVariant;
begin
with dm do
begin
try
qry.Close;
qry.SQL.Clear;
qry.SQL.Add(strQuery);
qry.Open;
RetVal := dspQuery.Data;
SetComplete;
except
SetAbort;
end;
end;
Result := 1;
end;
//client side
//clCOM:TClientDataSet;
var
d:OleVariant ;
svr:ICOMTest ;
begin
svr :=CoCOMTest.CreateRemote('127.0.0.1');
strQuery := 'Select top ' + IntToStr(len) +
' * from Lcustomers where customerid like ''' + bgn + '%'';';
svr.GetRemoteRecordset(strQuery ,d);
clCOM.Data :=d;
......
end;
What's wrong with my codes?
Thanks,
Jak
|
|
|
| Back to top |
|
 |
Ralf Jansen Guest
|
Posted: Thu Mar 29, 2007 10:27 pm Post subject: Re: Invalid Data Packet error |
|
|
Jak schrieb:
| Quote: | I made a slight modification on the codes on server side, the dm would be
created dynamically when executing TCOMTest.GetRemoteRecordset, the
Catastrophic failure disappeared, but another exception 'Invalid Data
Packet' was threwn out. How to handle it?
|
Most likely an Exception on the server so that Retval isn't assigned with the
Data from you datasetprovider. You have to check that your Datapacket is valid
before assigning it to clientdataset.Data. Assigning an empty OLEVariant will
throw the mentioned exception.
--
Ralf Jansen
deepinvent Software GmbH - Viersen, Germany - http://www.deepinvent.com
Blog: http://blog.mailstore.com/
Archiving E-mails with MailStore: http://www.mailstore.com |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|