charlesherndon
charlesherndon

Reputation: 1

ADOConnection in XE2

I am trying to learn how to use MS Access in XE2.

I have a form with:

The ConnectionString is:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Charles\Documents\addressbook.mdb;Persist Security Info=False

The "Test Connection" button on the Datalink properties screen says "test Connection Succeeded".

This is the button code:

if ADOquery1.Active then ADOquery1.Close;
ADOquery1.SQL.Add('select * from contacts');
ADOquery1.Open;

When I click the button, I get an error:

Missing Connection or ConnectionString

Upvotes: 0

Views: 405

Answers (1)

Ilyes
Ilyes

Reputation: 14928

Follow this steps:

  • When you test your connection and you got "Connection Succeeded" then activate your TADOConnection , In the Objects Inspector Set the connected property of the TADOConnection to True (Connected = True).

  • For the TADOQuery component , the connection is messing , In the Object Inspector , after you click on the TADOQuery , You will find Connection property , Select your TADOConnection.

Upvotes: 1

Related Questions