Thursday, 11 August 2011

How to create a connection string in Visual Studio (C#.net)

1. In the solution explorer of Visual Studio, open the 'web.config' file
2. Find '<connectionStrings/>' under <configuration> tag and delete it.

3. Now determine the connection string of your database, goto server explorer in visual studio and right click on your database to navigate to its properties. copy the value of field Connection String.

 

4. Now  create a new tag '<connectionStrings>' and write <add name="ANY_NAME" connectionString="PASTE_CONNECTION_STRING_HERE"/>; AND CLOSE IT WITH
'</connectionStrings>'



5. YOU ARE DONE!!!

No comments:

Post a Comment