- .Net Errors (3)
- .Net Question (10)
- 3 – Tier Architecture (2)
- AJAX (2)
- ASP.Net (60)
- ASP.Net – SQL Server (7)
- ASP.Net Controls (16)
- ASP.Net Example (102)
- ASP.Net Objects (4)
- Blog (1)
- Blogger (1)
- C Program (82)
- FileUpload (2)
- JQuery (7)
- PHP (1)
- PROJECT (10)
- Software Development (1)
- SQL (21)
- SQL Function (8)
- SQL-SERVER (24)
- Validation Control (7)
- Web Server (3)
- Windows Application (8)
Databse Connection between ASP.Net and SQL-Server using Wizard
Database Connectivity between ASP.Net and SQL-Server
There are many method to make connection between ASP.Net and SQL-Server.
1. Connection using TableAdapter and StoredProcedure thought Wizards.
2. Connection using SQLCommand and SQLDataAdapter using StoredProcedure .
3. Connection using SQLDataAdapter and SQLConnection writing query in webpage.
STEP 1 – Open the SQL-Server and Create New Database for connectivity.
Now Create New Table “UserMst” in Database Example.
STEP 2 – Create Stored Procedure for Select Data.
Fiil up the Record in Created Table named UserMst
STEP 3 – Now close the SQL Server and Open the Visual Studio .Net
Right Click on the Project Name then add App_Code folder from Add New ASP.NET Folder.
STEP 4 – Add new Dataset from Add new Item in App_Code folder..
After that do as below screen….
write your database server name and select below your Database for Connection.
Now click next button and select option ” Use Existing Stored Procedure” in below screen.
Now, Select the Stored Procedure which we created…
Now uncheck “fill a Data Table option below screen, and Write Select instead of GetData..
Here, we have DataTable and TableAdapter…
STEP 5 – Now save the project and go to the Default.aspx page.
STEP 6 – Write the below code in Button Click Event….
protected void btngetdata_Click(object sender, EventArgs e)
// Declare DataTable and TableAdapter Object here..
User_DS.USERMST_SELECTDataTable USerDT = new User_DS.USERMST_SELECTDataTable();
User_DSTableAdapters.USERMST_SELECTTableAdapter UserAdapter = new User_DSTableAdapters.USERMST_SELECTTableAdapter();
GridView1.DataSource = USerDT;
Now we have done connectivity between ASP.Net and SQL – Server