Link to home
Start Free TrialLog in
Avatar of bjones8888
bjones8888Flag for United States of America

asked on

Delphi XE4 ADORecordset - trouble setting the active connection

Hi, Experts.  I'm new to Delphi XE4.  I have lots of years with Delphi 5, a little with Delphi 2006, but am trying to make the leap to XE4.

I have few Delphi 2006 windows service programs that run fine.  I'm trying to create a new one in XE4, based on one of my existing Delphi 2006 programs.

One change that happened somewhere between 2006 and XE4 is the _Recordset object's _Set_ActiveConnection now takes a parameter of IDispatch instead of string.

In my ignorance, I've simply changed the string parameter to IDispatch and tried typecasting.  (Don't laugh too long.)

I've read a bit of the help file on IDispatch and that gave me no better understanding.

What I'm trying to do in this program is read an encrypted ADO connection string from an INI file, and use that to make a connection to a SQL database to get a set of records that I have to process in the timer event of my service program.

The event log gives me the Microsoft equivalent to "you can't get there from here" when the service program gets to

MyRecordSet._Set_ActiveConnection(FConnectionString);  

// FConnectionString is a typecast IDispatch of a string from reading the ini file.

I'd sure appreciate some direction on how to set the connection string for an ado connection.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bjones8888

ASKER

It seems to me like the older version of Delphi may have created the connection object "on the fly" if one wasn't specified.

In any event, I'm now successfully using a TAdoConnection object, setting its connection string, and setting Connected to True. Then I use TAdoQuery to do the record processing.

Thank you!