I am not able to reply to the suggestion I got to my last query so have started another thread with the same name as a follow on.
If I remove the "user instance=true", I get an error message "Invalid value for key 'connect timeout'. If I remove the "connect timeout=30" then I get another error suggesting that the server is not configured for remote connections.
The server is SQL 2005 Express and on the same computer's "C" drive so should not require remote connections.
I have already tried using "sp_configure 'user instances enabled','1' " on the database after connecting through SQL Server Management Studio and, although the command is executed successfully, I still cannot use the connection string.
May I add that this problem does not exist on only one computer. I have tried using connection strings on 4 computers with different operating systems and all of them fail so could it be something in the setup of SQL Server 2005 that I am doing wrong.
I have searched the web for nearly 7 years in an attempt to resolve this problem and I have still not succeeded
In the other post you provided the connection string like this,
Dim connStr As String = ("Server=(Local);AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Adventureworks_Data.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True)")
Is this how it looks in your code? Cause that looks not correct. There should be a semi colon after the last value and the ')' should not be there. Also enclosing the path to the file might be a good bet. Something like this.
Dim connStr As String = "Server=(Local);AttachDbFilename='C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Adventureworks_Data.mdf';Integrated Security=True;Connect Timeout=30;User Instance=True;"
Also, what was the problem when trying to reply here in the forum?
I've deleted this question and moved all posts to the original question. /Max