Cant connect to SQL Server 2000 Developer edition

G

Guest

Hi,
I have been trying to connect SQL Server2000 developer edition using the
following string.

SqlConnection conn = new
SqlConnection("server=localhost;database=pubs;uid=sa;pwd=");

I dont know where i am going wrong.

SQL Server Service Manager shows the following:
Server : Hemant
Services : SQL Server
Running \\Hemant -MSSQLServer

Even tried this command and numerous other combination but none seems to work.

SqlConnection conn = new
SqlConnection("server=Hemant;database=pubs;uid=sa;pwd=");

I want to establish connection using SqlConnection to the database pubs
using C# in .NET IDE.

Help me out. Where am i getting it wrong?? If someone else has answered
this question then provide me the link.
 
M

Marc Scheuner [MVP ADSI]

SqlConnection conn = new
SqlConnection("server=localhost;database=pubs;uid=sa;pwd=");

Use "(local)" or "." for your local server.

server=(local);database=pubs; etc.
or
server=.;database=pubs; etc.

Marc
================================================================
Marc Scheuner May The Source Be With You!
Berne, Switzerland m.scheuner -at- inova.ch
 
M

Miha Markic [MVP C#]

Create a Data Connection within Server Explorer, then drag&drop it on the
form.
It will create a SqlConnection with correct connection string for you.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Drag&drop
 
G

Guest

Hi,

Both of you thanks for the reply( Marc Scheuner, Miha Markic) . I used
the server explorer to test my connection and finally got the connection
string right. Yes you motivated me further to drill down into sql server and
learn more about it.

Thanks again to both of you ( Marc Scheuner , Miha Markic)
Have a nice day!
Hemant


Miha Markic said:
Create a Data Connection within Server Explorer, then drag&drop it on the
form.
It will create a SqlConnection with correct connection string for you.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Drag&drop
hemant said:
Hi,
I have been trying to connect SQL Server2000 developer edition using the
following string.

SqlConnection conn = new
SqlConnection("server=localhost;database=pubs;uid=sa;pwd=");

I dont know where i am going wrong.

SQL Server Service Manager shows the following:
Server : Hemant
Services : SQL Server
Running \\Hemant -MSSQLServer

Even tried this command and numerous other combination but none seems to
work.

SqlConnection conn = new
SqlConnection("server=Hemant;database=pubs;uid=sa;pwd=");

I want to establish connection using SqlConnection to the database pubs
using C# in .NET IDE.

Help me out. Where am i getting it wrong?? If someone else has answered
this question then provide me the link.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top