How can connect SQL in .net Frame Work? Give me step by step
How can connect SQL in .net Frame Work? Give me step by step process :)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 11, 2013, 9:28 PM EST
hi,
Please refer following link it might help you.
http://csharp.net-informations.com/data-providers/csharp-sql-server-connection.htm
http://www.codeproject.com/Articles/4416/Beginners-guide-to-accessing-SQL-Server-through-C
http://msdn.microsoft.com/en-us/library/s4yys16a(v=vs.90).aspx
Anubhav ChaudharyRank #29 · 42K reputationPosted Dec 11, 2013, 9:33 PM EST
1. First of All Open your .NET, then Add a New WebSite or Project as you wish to.
2. After that Add a new WebForm like this:-
- Right click on your Solution Explorer
- Choose to Add New Item
- Now choose a WebForm and Click on Add Button
3. Now Go to the Server Explorer of your Application.4. Right click on Data Connection and choose to Add Connection.
5. A new Window will get open, here provide your Server Name, if you doesn'y know your Server Name then just write a dot(.) in the Server Name.
6. If your SQL doesn't require any password then click on Windows Authentication but if it require UserName and Password then click on Server Authentication and provide them
7. Now go to the .aspx.cs page of your WebPage
8. Here Add this NameSpace on the top:- using System.Data.SqlClient;
9. Now Add Sql Command and SQL Connection like this:-
SqlConnection x;
10. Now go to the click Button from where you want to execute your code and Add Write code like this:-
11. Data Source=.;Initial Catalog=test;User ID=sa;Password=*******
This thing can be obtained by checking the property of Newly Added Database which you will find in the Server Explorer
I hope I am clear enough.