I have the following Connection String in VB.NET:
Friend DBConnectionString as String = "Persist Security
Info=False;Integrated Security=SSPI;Initial Catalog=MyApp;server=" &
ServerName
Friend cn as New SqlClient.SqlConnection(DBConnectionString)
The ServerName is read from the registry and contains the server computer IP
address. Working with local server, this value is naturally 127.0.0.1
On my desktop computer, the application is working OK accessing the local
database. I've also installed the application on several computers with no
problems with DB connection.
The strange thing is that I now installed the application on a computer
where there is a problem establishing the connection to the local DB. When
debugging the application I discovered that the DBConnectionString assignment
was being called before the registry value for ServerName was read.
Therefore the connection string value after assignement is:
DBConnectionString = "Persist Security Info=False;Integrated
Security=SSPI;Initial Catalog=MyApp;server="
which as suspected leads to connection to server problem.
My question is: How come that on all the other computers (where the
connection string has a value of nothing for server), the application is able
to access the local database?
Are you using threads?
Are any of your functions ASync?
-Walt
"isgooner" <isgooner@.discussions.microsoft.com> wrote in message
news:E88B3C5D-A350-4814-AA3C-E3C088100801@.microsoft.com...
> I have the following Connection String in VB.NET:
> Friend DBConnectionString as String = "Persist Security
> Info=False;Integrated Security=SSPI;Initial Catalog=MyApp;server=" &
> ServerName
> Friend cn as New SqlClient.SqlConnection(DBConnectionString)
> The ServerName is read from the registry and contains the server computer
IP
> address. Working with local server, this value is naturally 127.0.0.1
> On my desktop computer, the application is working OK accessing the local
> database. I've also installed the application on several computers with no
> problems with DB connection.
> The strange thing is that I now installed the application on a computer
> where there is a problem establishing the connection to the local DB. When
> debugging the application I discovered that the DBConnectionString
assignment
> was being called before the registry value for ServerName was read.
> Therefore the connection string value after assignement is:
> DBConnectionString = "Persist Security Info=False;Integrated
> Security=SSPI;Initial Catalog=MyApp;server="
> which as suspected leads to connection to server problem.
> My question is: How come that on all the other computers (where the
> connection string has a value of nothing for server), the application is
able
> to access the local database?
|||Neither
"Walter Holm" wrote:
> Are you using threads?
> Are any of your functions ASync?
> -Walt
> "isgooner" <isgooner@.discussions.microsoft.com> wrote in message
> news:E88B3C5D-A350-4814-AA3C-E3C088100801@.microsoft.com...
> IP
> assignment
> able
>
>
Monday, March 19, 2012
Incorrect connection string is working...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment