Updating dataset
-
I put together a form with one text box on it. Add a database connection, dataadapter and create a dataset. I databind the text box through properties. I use the fill command to fill the textbox with data. I see the data. I edit the data and the dataset does not seem to accept it. If I do exactly the same thing using a datagrid instead of the textbox, it takes the change I made... All sample code that I can find deals with datagrids, there is nothing that I can find for a simple textbox. Figuered it out as follows: Dim nsn As String nsn = txtSchoolName.Text Me.DsSchoolInfo1.tbl_SchoolInfo.Rows(0).BeginEdit() Me.DsSchoolInfo1.tbl_SchoolInfo.Rows(0)("SchoolName") = nsn Me.DsSchoolInfo1.tbl_SchoolInfo.Rows(0).EndEdit() Try Me.DbaSchoolInfo1.Update(DsSchoolInfo1) Catch x As Exception End Try Me.Close()DSS -- modified at 20:57 Monday 1st May, 2006
-
I put together a form with one text box on it. Add a database connection, dataadapter and create a dataset. I databind the text box through properties. I use the fill command to fill the textbox with data. I see the data. I edit the data and the dataset does not seem to accept it. If I do exactly the same thing using a datagrid instead of the textbox, it takes the change I made... All sample code that I can find deals with datagrids, there is nothing that I can find for a simple textbox. Figuered it out as follows: Dim nsn As String nsn = txtSchoolName.Text Me.DsSchoolInfo1.tbl_SchoolInfo.Rows(0).BeginEdit() Me.DsSchoolInfo1.tbl_SchoolInfo.Rows(0)("SchoolName") = nsn Me.DsSchoolInfo1.tbl_SchoolInfo.Rows(0).EndEdit() Try Me.DbaSchoolInfo1.Update(DsSchoolInfo1) Catch x As Exception End Try Me.Close()DSS -- modified at 20:57 Monday 1st May, 2006
first locate datarow position ((me.bindingcontext(dataset,"ur tablename").position) then update it with a command builder: cb = new oledbcommandbuilder(da) da = cb.dataadapter da.update(ds,"yourtablename") good lock!:-D
-
first locate datarow position ((me.bindingcontext(dataset,"ur tablename").position) then update it with a command builder: cb = new oledbcommandbuilder(da) da = cb.dataadapter da.update(ds,"yourtablename") good lock!:-D
-
Thanks for the help. I was still not successful in my attempt trying with your proposed solution. I posted some code in my question that I tried as well... DSS
Sometimes, see your question is related to this http://www.codeproject.com/script/comments/forums.asp?msg=1401837&forumid=1646&Page=2&userid=2682888&mode=all#xx1401837xx[^]
Regards,
Chatura Dilan