Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi _Recordset: Interface not supported (https://www.delphipraxis.net/119568-_recordset-interface-not-supported.html)

SyntaxError 28. Aug 2008 12:21

Datenbank: SQL Express • Version: 2005 • Zugriff über: ADO

_Recordset: Interface not supported
 
Hallo,

Ich habe ein Problem mit einem verbindungslosem Recordset, dass ich über TSocketConnection von einem einem Server erhalten möchte. Der Server stellt die Funktion "GetRs(Query: widestring): OleVariant " bereit, welche ein Recordset als OleVariant zurückgibt:

Delphi-Quellcode:
function TMyRemoteDataModule.GetRS(const AQuery: WideString): OleVariant;
var
aRs: _Recordset;
begin
aRs := CoRecordset.Create();
aRs.Set_ActiveConnection(AConnectionObject);
aRs.Open(AQuery,AConnectionObject, adOpenKeyset, adLockBatchOptimistic, adCmdText);
result := aRS; //Ars;
aRs.Set_ActiveConnection(nil);
end
auf der Client Seite versuche ich nun den OleVariant wert in ein _Recordset zu casten, doch ich erhalte eine "Interface not supported" exception:

Delphi-Quellcode:
procedure TClientDataModule.GetRecordSet(AQuery: WideString; var ARecordset: _Recordset);
var
rsOV: OleVariant;
temp: IDispatch;
begin
rsOV := DBConnectionBroker.AppServer.GetRS(AQuery);
temp := IDispatch(rsov); // das funktioniert!
ARecordset := IDispatch( rsOV) as _Recordset; //hier wird die exception ausgelöst!
end;
Kann mir hier jemand weiterhelfen?


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:15 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz