SQL Connectionstring in ASP.Net


Using webconfig

Switch Statement

Start a new project in your visual studio IDE. Select the template asp.net empty project and check the language, it must be c#.

Once the project is build. It is time to add new item in your project. Right click on the project in a solution explorer. –>Add–>New items–>Web Form . Give it a name and add it. As you can see in the below figures.


As per this is just an example to help you in connection string. You will find no designing to the Page.
Add a header and a button in your page. You can find it in a below figure with a code.


We need to include the library to pass the connection string using webconfig.

The ASP.NET configuration data is stored in an XML text files
Each named a Web.config. Web.config file can appear
in multiple directories in ASP.NET application. You can see a web config file in the above figure.

You will have to define a connection string in the web config file . You can move to the previous lesson to understand the connection string.

Now, go back to the web form you created in your project and double click on the button to reach the code behind. paste the following code

For downloading the source code click here





If you enjoyed this article, Get email updates (It’s Free)

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

2 Responses

  1. maillot griezmann france 2014
    maillot griezmann france 2014 at |

    maillot griezmann france 2014

    I’m not sure where you are getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for fantastic info I was looking for this info for my mission.

  2. Lonng Journeyy
    Lonng Journeyy at | | Reply

    thank you . and hope i will post further for your understanding of programming ..you can also ask me for what you want me to post about .


Leave a Reply