Inserting Data into a Microsoft SQL 2008 Database in ASP.NET 3.5
(Page 1 of 4 )
In the previous article, "Creating an ASP.NET Dynamic Web Page using a MS SQL Server 2008 Database (GridView Display)," you learned how to create a dynamic web page that can let the user edit and delete database records directly using a web browser. It was demonstrated with a home renovation project, where team leaders can update and delete project tasks online. However, it does not include features that let users add or insert new records directly into the database using a web browser. This feature will be covered in this tutorial.
It is recommended that you read the first part as well, to completely create the demo project in that tutorial in Visual Web Developer Express 2008. That project will be used and extended in this tutorial.
Case Study Example: Home Renovation Project
The case project study of the previous article displays database records in the web browser and then lets the user (the supervisor) either update or delete records (see screen shot): http://www.dotnetdevelopment.net/tutorials/gridview6.jpg
Let's improve this by adding a feature that can accept new records from the browser and put them into the database. You can do this by following the plan below:
You can create a new ASPX file called Insert.aspx which will be the page used for inserting records into the MS SQL database. The yellow color means that it is a new feature to be added, while the gray one is for the existing features of the previous web project.
Of course, there should be an HTML hyperlink from the Default.aspx going to Insert.aspx and vice versa, so users can easily navigate though web contents for adding and updating data.
Since Insert.aspx will be used to insert records, it needs ASP.NET controls for communicating with the Renovation project MS SQL database (details will be discussed below).
Next: Create the Insert.aspx File in Visual Web Developer >>
More ASP.NET Articles
More By Codex-M