how to add connection string for a windows form applicaton in asp.net

Posted by manoj chalode on Stack Overflow See other posts from Stack Overflow or by manoj chalode
Published on 2012-08-29T15:31:56Z Indexed on 2012/08/29 15:38 UTC
Read the original article Hit count: 186

i am working on windows form application and i want to add connection string of a database in. Right now, though i can access database i don't know the proper reasoning behind it. I have created a database and added it in a "Database" folder. The code for it is given below. i also want to know how can I make a connection string which can work on different PCs without changing it (I'm talking about relative path given in the "AttachDbFilename" attribute in the connection string). Reply...

Conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename="+ Application.StartupPath + "\\Database\\Database.mdf;Integrated Security=True;User Instance=True");

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about database-connection