SQL Express Connection String

To let ASP.NET to search the database location, use the following connection strings in the web.config in specific cases

-> in the default data folder

connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"

-> in an absolute path

connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\NewMembershipProvider\App_Data\Members.mdb;Persist Security Info=False"

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
Print | posted on Friday, July 07, 2006 3:51 PM

Feedback

# re: SQL Express Connection String

left by Jasmin at 6/18/2008 1:51 AM Gravatar
You helped me. Thanks.

# re: SQL Express Connection String

left by chathuranga at 6/11/2010 9:59 PM Gravatar
I gave Data Source of the connection string as this,
"Data Source=ComputerName\SQLEXPRESS"
But it didn't work saying that character"\" is not a valid. I'm using VS 2008 trial.

# re: SQL Express Connection String

left by Rajesh at 9/1/2010 8:53 PM Gravatar
its not working, it shows an error saying unrecognized escape sequence
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: