|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
CurrencyManager QuestionCurrencyManger has a method called AddNew which well create a new record in the data that it is bound to (ie a new datarow in a table). The new record has null values for all of its elements. What I would like to have is the ability to add a new record using the current values of the TextBox fields that have been bound to the datasource. I have tried various solutions to have the code edit the record using the current values after it has been created, but the null values cause a 'System.Data.NoNullAllowedException' error. Here is one attempt: objCurrencyManager.AddNew() objCurrencyManager.EndCurrentEdit() Any ideas? Thanks, Aaron Hartley,
Seems difficult to me, because when you use whatever AddNew method than there will be a new row created. The CurrencyManager AddNew set direct the pointer to this new added row and therefore your textbox is nothing at that moment. In my opinion is what you try to do not in the line of binded bounds or in other words. It does me reminds on that Jewish Witz (joke), that I have more times writen in this newsgroup. Cor <hartley_aa***@hotmail.com> schreef in bericht Show quoteHide quote news:1148661067.836156.189840@y43g2000cwc.googlegroups.com... > Hi, > > CurrencyManger has a method called AddNew which well create a new > record in the data that it is bound to (ie a new datarow in a table). > The new record has null values for all of its elements. What I would > like to have is the ability to add a new record using the current > values of the TextBox fields that have been bound to the datasource. > > I have tried various solutions to have the code edit the record using > the current values after it has been created, but the null values cause > a 'System.Data.NoNullAllowedException' error. Here is one attempt: > > objCurrencyManager.AddNew() > objCurrencyManager.EndCurrentEdit() > > Any ideas? > > Thanks, > Aaron > Cor,
> It does me reminds on that Jewish Witz (joke), that I have more times writen The null row is the heavy stone!> in this newsgroup. In the past I always have coded everything directly against the datatables. This works great except that I end up with a lot of code which creates more maintenance overhead. I wanted to try binding and see if it would be an improvement. The example in my VS book has the code insert the row into the database and then reload the datatable from the database. This skirts around the issue entirely. While this method keeps the datatable very current, it also has higher network and processing overhead. Some situations may call for this while others may call for something more detached and efficient. Is the AddNew method totally worthless? Aaron I don't think it is worthless, only you have to use an add button first
before you start entering. That is just two times expirience and it is done. The update button does than everything as well for other updates, but than complete for all changed rows. Just my thought, Cor <hartley_aa***@hotmail.com> schreef in bericht Show quoteHide quote news:1148669995.992003.127810@j33g2000cwa.googlegroups.com... > Cor, > >> It does me reminds on that Jewish Witz (joke), that I have more times >> writen >> in this newsgroup. > > The null row is the heavy stone! > > In the past I always have coded everything directly against the > datatables. This works great except that I end up with a lot of code > which creates more maintenance overhead. I wanted to try binding and > see if it would be an improvement. > > The example in my VS book has the code insert the row into the database > and then reload the datatable from the database. This skirts around > the issue entirely. While this method keeps the datatable very > current, it also has higher network and processing overhead. Some > situations may call for this while others may call for something more > detached and efficient. > > Is the AddNew method totally worthless? > > Aaron > Aaron,
You mean something as this? http://www.vb-tips.com/default.aspx?ID=c6c7d9a8-7511-41a1-a488-2e91e5295e7c Cor Show quoteHide quote "Aaron" <hartley_aa***@hotmail.com> schreef in bericht news:1149000663.304278.126730@j55g2000cwa.googlegroups.com... > Cor, > > Do you have any example code that you would be willing to share? > > Aaron >
Console app no accessible 'Main' method with an app...
Overnight processes Closing another application why are there still COM controls in VS.Net 2005? datagridview cell - get row/column info for updating data- how? Convert VBScript to Visual Basic .Net LockWindowUpdate VB 2005 Converting IP Address as string to MyIP as IPAddress type 'pageClass' is not defined Registry |
|||||||||||||||||||||||