• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

ADODC.connectionstring empty at form_load...

I want to specify my ADODC.Connectionstring during the form_load of a program and keep this property empty as initial value. But I get an error at startup (before the form_load is completed) that the string is missing. With a normal Data-control the data1.databasename can be specified in the form_load. Why not with ADODC?
0
juul040798
Asked:
juul040798
  • 2
1 Solution
 
mkmccrearyCommented:
Is the error you get:
    Data Source name not found, and no default driver specified.

or something like that.  If so try this.  Clear both the ConnectionString and the RecordSource property of the ADODC.  Then set the ConnectionString first, and the RecordSource next, during your Form_Load.  If this isn't your error, give me a little more information and I will try to figure it out for you.

Good Luck,
Martin
0
 
agarwal_rahulCommented:
As Martin said clear both Connectionstring and Recordsource property and set at run time.

e.g

form_load()
    Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind;Data Source=SG73300233"
    Adodc1.RecordSource = "SELECT * FROM ORDERS"
    Adodc1.Refresh
end sub

0
 
juul040798Author Commented:
Is it possible that the adodc1.refresh is crucial in this subject. When I do this without the refresh, it seems not to work...
0
 
agarwal_rahulCommented:
Without Refresh u will not be able to populate the recordset.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now