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:
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:
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?
Grüsse
Michele
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:
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:
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?
Grüsse
Michele