|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie Missing Something with Access DB Update Using VB .NETAccess DB. I have a slew of textbox controls bound to a dataset and when the application launches, the fields are correctly populated. If someone changes a value in one of the text boxes, I need to have a button capture the change and commit the update to Access. I know I'm close, but something is missing. I have a data adapter called: OleDbDataAdapter1 and a dataset called: DsMyMonthlyIncome1 My button function is: Try OleDbDataAdapter1.Update(DsMyMonthlyIncome1) Catch ex As Exception MsgBox(ex.ToString) End Try No error occurs, but the changed information in the text field never gets communicated to the Access DB. Have I not captured the changes by having the textbox controls bound? I've searched quite a bit today, and not found the information I seek. I am lost here and appreciate the help. I am using VS 2003. Hi,
Show quoteHide quote "pooba53" <poob***@gmail.com> wrote in message If your update doesn't work only for the last edited field, then you need to news:1168883383.411233.316440@l53g2000cwa.googlegroups.com... >I have a VB .NET application that is communicating properly with an > Access DB. I have a slew of textbox controls bound to a dataset and > when the application launches, the fields are correctly populated. > > If someone changes a value in one of the text boxes, I need to have a > button capture the change and commit the update to Access. I know I'm > close, but something is missing. I have a data adapter called: > OleDbDataAdapter1 > > and a dataset called: > DsMyMonthlyIncome1 > > My button function is: > Try > OleDbDataAdapter1.Update(DsMyMonthlyIncome1) call CurrencyManager.EndCurrentEdit() before the Update. A CurrencyManager can be obtained from the Form's BindingContext, eg.: ' Important: use the same DataSource and DataMember(exluding fieldname) ' as the ones you used to setup the bindings. ' If you used the designer to setup the bindings then: ' DataSource = DsMyMonthlyIncome1 ' DataMember = "YourTableNameHere" Dim cm As CurrencyManager cm = DirectCast(BindingContext(DataSource, DataMember),CurrencyManager) cm.EndCurrentEdit() OleDbDataAdapter1.Update( DsMyMonthlyIncome1 ) If that doesn't help, then first check whether DataSet has changes before doing the DataAdapter.Update: Console.WriteLine( DsMyMonthlyIncome1.HasChanges() ) HTH, Greetings Show quoteHide quote > > Catch ex As Exception > MsgBox(ex.ToString) > End Try > > No error occurs, but the changed information in the text field never > gets communicated to the Access DB. Have I not captured the changes by > having the textbox controls bound? > > I've searched quite a bit today, and not found the information I seek. > I am lost here and appreciate the help. > > I am using VS 2003. >
Copying to the clipboard
breaking up a String into an array of chars and adding to datatable Option Strict issue Make the value of MyObjectA equal to the value of MyObjectB? System.Net.Sockets.SocketException Error not CLS-compliant How to go to the next control? Automate file downloads converting bitarray to int64 ListView and Registry Key |
|||||||||||||||||||||||