hiii friends.
i am using following code and it shows error near bold
SqlConnection cn = new SqlConnection(".\SQL;User Id=sa;Password=pass@123;Initial Catalog=test");
help me..its urgent
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pankaj PandeyRank #642 · 3.7K reputationPosted Jun 17, 2013, 5:35 AM EDT
SqlConnection cn = new SqlConnection("Data Source=your server name;User Id=sa;Password=pass@123;Initial Catalog=test")
RIM Singh46 reputationPosted Jun 17, 2013, 5:37 AM EDT
it is not working..
Riyaz AkhtarRank #2,275 · 619 reputationPosted Jun 17, 2013, 5:41 AM EDT
SqlConnection cn = new SqlConnection("Data Source=.\sqlexpress;User Id=sa;Password=pass@123;Initial Catalog=test");
Pankaj PandeyRank #642 · 3.7K reputationPosted Jun 17, 2013, 5:42 AM EDT
SqlConnection cn = new SqlConnection(@".\SQL;User Id=sa;Password=pass@123;Initial Catalog=test");
i hope it will work, because connection string is ok,
if not then check your sql server setting.
open sql server, put .\SQL in server name, select window authentication and press ok, if it connect then it means connection string is ok...other wise you entered wrong server name.
mark as answered if helpful
RIM Singh46 reputationPosted Jun 17, 2013, 5:47 AM EDT
Error was "@" and also in connection string..i am using now..
SqlConnection cn = new SqlConnection(@"Data Source=.\sqlexpress;User Id=sa;Password=pass@123;Initial Catalog=test");
it works
thnx
Amit ChoudharyRank #145 · 15.8K reputationPosted Jun 17, 2013, 9:27 AM EDT