unable to connect to Database over a network

  • Thread starter Thread starter Arun Nair
  • Start date Start date
A

Arun Nair

Hi,
I am trying to connect to a remote SQL Server 2000 on a local lan in
C#. I have tried the following connection string:
connectionString = "DSN=empex;SERVER=SARK011/Test;DATABASE=empexchange;Network=DBMSSOCN;Address=172.21.1.11;UID=anair;PWD=anair;";
and

connectionString = "Provider=SQLOLEDB;Data Source=empex;Initial
Catalog=panchayatNetwork=DBMSSOCN;;User
Id=panchayat;Password=panchayat"

With both of this I get the following error:
Index#0
Message:[DBNETLIB][Connection open(Connect()).]Specified SQL server
not found.
Native:6
Source:Microsoft OLE DB Provider for SQL Server
SQL:08001



I am able to connect to both the database thru the ODBC Data Source
Administrator tool.
What am i doing wrong?

I able to connect to the NorthWind database with any problem.

I am able to connect to the other two databases from VB6 and Java

thanks,

Arun
 
Mary is on the right track. However, you're making several other mistakes as
well. First, you should connect to SQL Server 2000 with the SqlClient Data
Provider--not OleDb. Next, when using an OleDb provider, you can't use an
ODBC DSN--that's only supported by the ODBC Data Provider.

Incidentally, it's a very bad idea to publish your connection string to the
planet as you have done.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Back
Top