Friday, 31 August 2012

insert into database - ASP.Net

This Tutorial is about insert data into database in Here is steps:

Step 1:

First create the form where you enter the record.

Insert Form
Insert Form

Step 2:

Now add a "DataSet" in the project and insert the table from the database in it. After this write the following code against the button click event.

            DataSet1TableAdapters.tbl_PersonInfoTableAdapter obj_adapter = new DataSet1TableAdapters.tbl_PersonInfoTableAdapter();
            obj_adapter.Insert(TextBox1.Text, TextBox2.Text);
            Label1.Text = "OK! Data Inserted";
        catch (Exception exp)
            Label1.Text = "Error! No data Inserted";

Step 3:

Finally run the project.
Record Inserted
Record Inserted

Hope so this tutorial will help you to insert the record into the database in ASP.Net.

No comments:

Post a Comment