Help connnecting to sql server

K

Kingkel

hi every1 :lol: ,

i am new to .net and c# but i am making a good progress. i am working
on database connectivity but i cant connect to my sql
server(northwind). Pls tell me what am doing wrong :( .

I have tried 3 connectionStrings
"DATA SOURCE=(local); Initial Catalog=PUBS; Integrated
Security=SSPI";
"DATA SOURCE=(local); Initial Catalog=PUBS; UID=sa;Pwd=password";
"DATA SOURCE=(local); Initial Catalog=PUBS; User ID=sa;
Password=password";

but i keep getting this err mgs :

An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll

Additional information: System error.

pls tell me what to do, i believe connecting to sql server dbs will
boost my c# implementation.

thanks in advance.

King

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
G

Guest

If you are using SQL 6.5 or earlier specify the Provider in the Connection
String and in case if you are using SQL 7.0 or above, specify the string

"DATA SOURCE=localhost; Initial Catalog=PUBS; Integrated Security=SSPI";

DataSource should be localhost or your SQL Server Computer name


Raj
 
R

Richard Blewett [DevelopMentor]

Hmm, I frequently use (local) to connect to SQL Server 2000 and MSDE.

Without seeing ther actual exception trace (the fact that its a SQLException only tells us a small amount). You state that you wanted to connect to the northwind database (either that or you said the name of your server was northwind - I'll assume the former).Yet in the connection strong you specify the PUBS database as the database you want to connect to. Does the pubs database exist on the server?

Regards

Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog

If you are using SQL 6.5 or earlier specify the Provider in the Connection
String and in case if you are using SQL 7.0 or above, specify the string

"DATA SOURCE=localhost; Initial Catalog=PUBS; Integrated Security=SSPI";

DataSource should be localhost or your SQL Server Computer name


Raj
 

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