Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection string not working when deployed...

Status
Not open for further replies.

lidds

Programmer
Jun 9, 2005
72
GB
I have written a VB6 application that connects to an MS Access database using the following connection string:

Code:
myConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & myFilePath & ";"

This works fine on the computer that has Visual Studio 6 installed on it but when I deploy this to a test machine it gives me an error when trying to connect to the database. I think it must be something to do with it not finding the provider?

Both my test and development machine are Windows 7 x64 and both have up to FrameWork 4.0

Any ideas?

Thanks

Simon

 
Hi Simon,

Is your file path in the connection string using a mapped networked drive with a drive letter or using UNC path?
Is said share mapped at the destination computer?
Is named pipes activated server-side?

Cheers,
MakeItSo

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
No .Net Framework is required by a clean (no interop) VB6 program. The Jet 4.0 Provider does not use named pipes. We still don't know the error.

For all we know the problem is fixed by properly quoting the Data Source property value. Or perhaps we're looking at a file virtualization or WOW64 file redirection case since we don't know what's in myFilePath.
 
Ahh, so this is a case with .Net interop issues.

There is no MDAC in Win7, MDAC was replaced by the similar Windows DAC back when Vista came out. So there is no "MDAC 2.8 SP1" to be installed on Win7 - MDAC/DAC has been tailored code for a long time now and you can only install OS-specific Service Pack packages (usually each package handles a few Windows versions).


In your .Net error dialog it tells you "Parameter is invalid." You seem certain that this occurs where you try to use your connection string, so perhaps (if true) it is telling you that you have a bad parameter in your connection string.


You have failed to tell us what is in myFilePath but it might easily contain a character that will cause problems unless you quote it. I mentioned this 2 days ago.

You might try:
Code:
myConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & myFilePath & "'"

I suspect your value is based on App.Path, which is very likely going to cause you more problems after this one.
 
Do you know that the error is because of your connection string, or are you just guessing? The error message you are showing us certainly wouldn't make me think "uh oh, bad database connection".

If it was me, I'd verify the connection string just by making some little mini-app or VBA code (in Excel or something) that simply tries to establish an ADO connection with that connection string.

In my error logger I would write the exact connection string (i.e. the variable myConnStr) it tried to use - you may find out that myFilePath was not set to what you thought it was.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top