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?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

agarwal_rahulConnect With a Mentor Commented:
As Martin said clear both Connectionstring and Recordsource property and set at run time.


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

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,
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...
Without Refresh u will not be able to populate the recordset.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.