How to Connect DataBase in ASP.NET

preview_player
Показать описание


Step # 1 -- Opening your IDE and Selecting ASP.Net
First of all we'll need to open our IDE, In my case Visual Studio. Make sure you select the ASP.Net website template in the Visual C#.

Step # 2 -- Configuring Data Source

Step # 3 -- Generating connection string
Here we create a new connection by clicking on the button with the same name. Then we put the server name and select a database, I am going to use tempdb as my database. Now click on test connection in order to see if the database connection is established.

Step # 4 --Copy connection string
Copy the connection string from this window because we'll need it while configuring the button event handler in the code.

Step # 5 --Connecting the database
In the code, first of all add the sql client system class library. Then paste the connection string behind the event handler of our My connection button and finally in order to establish the connection we use the Open method.
Рекомендации по теме
Комментарии
Автор

❗ Subscribe To Our Main YouTube Channel

howtechweb
Автор

hello, its more useful for me but i can to connect to several databases like this?

mikejonson