开发者

Connection problem when connecting to MSDE2000 with .NET

I have a strange problem. I'm trying to connect to a Microsoft SQL server from C# (.Net 4.0). The server is running MSDE2000(8.00.194). When I connect I get the following message:

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target mac开发者_StackOverflowhine actively refused it.)

My connectionstring looks like this,(yes i'm using a blank password): "User Id=sa;Password=;Data Source=192.168.0.100\?,1433;Trusted_Connection=false;Initial Catalog=DATABASE1;"

I've tried changing pretty much everything in the connection string to get it to work without success. I've even tried doing an OleDBConnection instead of the SqlConnection but without success.

The strange thing is that when I connect through Microsoft Management Studio I'm able to connect and see everything. But I get disconnected between every command I send and have to reconnect.

Does anyone know what the problem might be or where I should start looking to find the problem?

Edit: I might add that I tried to telnet to the machine on port 1433 but got "Connection closed by host". The thing is that I do not have access to the computer so I can't check firewall settings but isn't the Management Studio connecting the same way as .Net do?


Are you sure the instance of such MSDE 2000 is up and running? can you connect to that instance remotely with your SQL Management Studio? Who has installed that instance? by default tcp connections are disabled in a default install, this still happened also in SQL Server 2005 Express (not sure about the 2008 version) so unless the guy who installed it has configured it properly or knew how to set it up, you could be missing some protocols to be enabled.

is that instance available locally on that machine?

check here for default connection strings, I also doubt that ? is a valid instance name and if you know the instance name you should specify it,

http://connectionstrings.com/sql-server#p1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜