dhanyavnair
09-29-2005, 11:40 PM
Hi,
I am having an asp.net form that will have some textboxes to enter person details like name address, date of birth etc..These details have to be stored in sql server.I have to take muliple person details..so what i am doing is i am saving these details one after the other to a datagrid by a button click..finally when all multiple person details are entered, i am inserting into the database using a submit button...my datagrids page count is set to 10.so The problem i am facing is i am not able to save more than 10 records ..the 11th record is overwritting the 10th one..Could anybody please help me to sort out this..the code i am using is as below...
Private Sub wbtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wbtnSave.Click
Dim dtb As New DataTable
Dim rowNew As DataRow
dtb = ChangeGrid_To_Datatable(employeedetails)
rowNew = dtb.NewRow
rowNew("Employee_Name") = txt_name.Text.Trim
rowNew("Address1") = txt_add1.Text.Trim
rowNew("Address2") = txt_add2.Text.Trim
rowNew("age") = txt_witness_age.Text.Trim
rowNew("D_O_B") = txt_wdob.Text.Trim
rowNew("zip") = txtwitness_zip.Text.Trim
rowNew("Phone") = txtwitness_phone.Text.Trim
rowNew("Email") = txtwitness_email.Text.Trim
dtb.Rows.Add(rowNew)
dtb.AcceptChanges()
employeedetails.DataSource = dtb
employeedetails.DataBind()
dtb.AcceptChanges()
employeedetails.DataSource = dtb
employeedetails.DataBind()
End Sub
Note:ChangeGrid_To_Datatable(employeedetails) is a function within the code that will convert the datagrid to a datatable.
Could anybody please help me to sort out this.
Thanks and Regards
Dhanya
I am having an asp.net form that will have some textboxes to enter person details like name address, date of birth etc..These details have to be stored in sql server.I have to take muliple person details..so what i am doing is i am saving these details one after the other to a datagrid by a button click..finally when all multiple person details are entered, i am inserting into the database using a submit button...my datagrids page count is set to 10.so The problem i am facing is i am not able to save more than 10 records ..the 11th record is overwritting the 10th one..Could anybody please help me to sort out this..the code i am using is as below...
Private Sub wbtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles wbtnSave.Click
Dim dtb As New DataTable
Dim rowNew As DataRow
dtb = ChangeGrid_To_Datatable(employeedetails)
rowNew = dtb.NewRow
rowNew("Employee_Name") = txt_name.Text.Trim
rowNew("Address1") = txt_add1.Text.Trim
rowNew("Address2") = txt_add2.Text.Trim
rowNew("age") = txt_witness_age.Text.Trim
rowNew("D_O_B") = txt_wdob.Text.Trim
rowNew("zip") = txtwitness_zip.Text.Trim
rowNew("Phone") = txtwitness_phone.Text.Trim
rowNew("Email") = txtwitness_email.Text.Trim
dtb.Rows.Add(rowNew)
dtb.AcceptChanges()
employeedetails.DataSource = dtb
employeedetails.DataBind()
dtb.AcceptChanges()
employeedetails.DataSource = dtb
employeedetails.DataBind()
End Sub
Note:ChangeGrid_To_Datatable(employeedetails) is a function within the code that will convert the datagrid to a datatable.
Could anybody please help me to sort out this.
Thanks and Regards
Dhanya