ADO Brick Wall

From: Chris Spencer (chris_at_tufware.com.au)
Date: 11/21/03


Date: Fri, 21 Nov 2003 20:10:32 +1100

I have the need to return a recordset as a variant from a DLL written in
Delphi to allow an application to process it. The app is not Delphi.
I have the following which is not quite corrrect. Any pointers on what I
need to do to get the connection working coorectly and be able to return the
variant back?
Thanks

Function GetSQLQuery(iServer:pChar; iDB:pChar; iSQL:pChar) : INTEGER ;
stdcall;
var
  sConnect : String ;
  sServer : String ;
  sSQL : String ;
  sDB : String ;
  vResult : OLEVariant ;
  vADO : TADOConnection ;
  iRows : Integer ;
begin
  sServer := iServer ;
  sDB := iDB ;
  sSQL := iSQL ;
  vADO := TadoConnection.Create(Nil);
  sConnect := ('Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Trusted_Connection=yes;Initial Catalog=' + sDB + ';Data
Source=' + sServer) ;
  vADO.LoginPrompt := False ;
  vAdo.ConnectionString := sConnect ;
  vAdo.Open ;
  vResult := vADO.Execute( sSQL, cmdUnknown
,[eoAsyncFetchNonBlocking]) ;
  vADO.Close ;
  VADO.Free;
  result := vResult ;
End;

Chris Spencer



Relevant Pages

  • Re: VB6, VB2005, or Something Else?
    ... And you are correct a Variant Object type would have helped. ... Regarding porting code IMHO the MS C++ compiler VC2005 is much superior than Delphi. ...
    (microsoft.public.vb.general.discussion)
  • Why was vt_Decimal variant support dropped?
    ... I was wondering why vt_Decimal variant support was dropped in Delphi. ... The reason I ask is because I use bigint fields in an MSSQL database which I ...
    (borland.public.delphi.non-technical)
  • ActiveX data marshalling
    ... I am writing a component in Delphi to use in VB (don't ask - there are very ... good reasons :-) ... Currently this is being sent back as a Variant array of Byte which means ... It looks like the favourite mechanism is some form of Variant. ...
    (microsoft.public.vb.controls)
  • Re: ADO Brick Wall
    ... Chris Spencer wrote in message ... > I have the need to return a recordset as a variant from a DLL written ... > in Delphi to allow an application to process it. ...
    (borland.public.delphi.database.ado)