From: MS Vasu on 2 Feb 2010 05:15 I am trying to update data base emp.mdb. I have a form which has 3 text boxs, txt_name, txt_age, txt_address and command button cmd_updatetogrid. I have MSHFlexigrid. When i press cmd_updatetogrid it updates the grid. So that i can keep on adding the records in the grid. Now i have one command button cmd_save. when i click on this button it adds all the records in the database emp.mdb. Now my problem is If i have two records in the grid. If the the record size of the grid (2nd row) is more than as defined in the database. then the error is fired. But the first row is updated. I do not want to update any row if any error occors in rows. So Please help me *** Sent via Developersdex http://www.developersdex.com ***
From: Ralph on 2 Feb 2010 07:27 "MS Vasu" <msvasu2all(a)gmail.com> wrote in message news:ODCmtC$oKHA.5328(a)TK2MSFTNGP04.phx.gbl... > > I am trying to update data base emp.mdb. > I have a form which has 3 text boxs, txt_name, txt_age, txt_address and > command button cmd_updatetogrid. > > I have MSHFlexigrid. When i press cmd_updatetogrid it updates the grid. > So that i can keep on adding the records in the grid. > > Now i have one command button cmd_save. when i click on this button it > adds all the records in the database emp.mdb. > > Now my problem is If i have two records in the grid. If the the record > size of the grid (2nd row) is more than as defined in the database. then > the error is fired. But the first row is updated. I do not want to > update any row if any error occors in rows. > > So Please help me > You can approach this problem several different ways. But we need more information to recommend any specific one. In general, you can wrap your 'update' within a Transaction. Look up: ADO BeginTrans, CommitTrans, RollbackTrans [Note that these can be Provider and Cursor dependent.] But what is the error? Perhaps you would be better off if you could catch whatever is causing the error through better validation while you are entering the data. How are you doing that now? If you are using Data Binding then you'll need create your own DataSource (w/Data Binding Collection) and manage the additions and updating within it. Also I assume you would like to know what particular row caused the problem? -ralph
|
Pages: 1 Prev: You guys still here? Next: Cannot export to Excel in Crystal report (cr8) |