I am trying to connect to a database through a web service. I am being able to connect to the databse through the server explorer in Visual Studio 2005, but when I try to do it with code in my application this is the message I get:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
My code looks like this:
SqlConnection thisConnection = new SqlConnection(@."Data Source=vse1092;Initial Catalog=CurrituckDB;Integrated Security=True;"); //User id=;Password=;");
thisConnection.Open();
I also tried putting my user id and password... but same message appears.
Any help will be greatly appreciated.
Thanks,
David
|||Try with VS.NET 2003|||Also, you can try looking in the server error log (by default at "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG") for an error message that might be more informative. Look for messages that correspond in time to the failed login attempts when you run the client application.
Hope this helps,
Vaughn|||Hi,
I faced a similar issue few days back. The issue was solved when I removed the Windows 2003 Service pack1 from my system. Try removing the service pack. If U have it installed or try removing security updates that U've recently installed.
By the way, are U able to connect to the database using the management studio ot enterprise manageer?|||In addition, please check out the SQL Protocols Blog (http://blogs.msdn.com/sql_protocols/) which contains a troubleshooting connectivity series.|||Hmmm... The best way to figure this out is by looking through the error log (as Vaughn suggested). If we had a bit more information about your configuration we could probably conjecture a bit more here.
One place we've seen this happen before is when the client stacks (in your case SQLClient) and the server are mismatched intermediate versions - for example, .Net Framework 2.0 beta 2 running against SQL Server 2005 beta 2. If you have mismatched intermediate releases, you'd see something like this.
There are other reasons you might see this. There's a swath of blogs up on http://blogs.msdn.com/sql_protocols that might have the answer your looking for.
Thanks.sql
No comments:
Post a Comment