Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / January 2007

Tip: Looking for answers? Try searching our database.

Newbie Missing Something with Access DB Update Using VB .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pooba53 - 15 Jan 2007 17:49 GMT
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)

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.
Bart Mermuys - 15 Jan 2007 23:50 GMT
Hi,

>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
[quoted text clipped - 11 lines]
> Try
> OleDbDataAdapter1.Update(DsMyMonthlyIncome1)

If your update doesn't work only for the last edited field, then you need to
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

> Catch ex As Exception
> MsgBox(ex.ToString)
[quoted text clipped - 8 lines]
>
> I am using VS 2003.
pooba53 - 16 Jan 2007 20:23 GMT
Thanks, Bart!

That's what I needed. I wonder why my book didn't include this useful
bit of information. Probably because the example was using DataGrid,
which may not require a CurrencyManager.

Thanks again.

-Dan

> Hi,
>
[quoted text clipped - 48 lines]
> >
> > I am using VS 2003.
aaron.kempf@gmail.com - 16 Jan 2007 23:07 GMT
access is drag and drop; or insert autoform.

.NET is impractical and obsolete

-Aaron

> Hi,
>
[quoted text clipped - 48 lines]
> >
> > I am using VS 2003.
aaron.kempf@gmail.com - 16 Jan 2007 19:17 GMT
keep it in Access and use VBA forms

.NET is a failure

the framework isn't on ANYONES desktops.. and it shouldn't be because
it's just bloatware

Access / VBA is fast enough for anything that you need to do; using
.NET all it does is make things SLOWER

-Aaron

> 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
[quoted text clipped - 24 lines]
>
> I am using VS 2003.
pooba53 - 16 Jan 2007 19:46 GMT
Then it requires the user to own a copy of Access, which may not be the
case for who this software is being targeted to.

-Dan

> keep it in Access and use VBA forms
>
[quoted text clipped - 36 lines]
> >
> > I am using VS 2003.
aaron.kempf@gmail.com - 16 Jan 2007 23:06 GMT
Dan

it doesn't require jack sh.t and you're not subjected to DLL _HELL_ and
apps that take a half hour to launch

VB.net isn't ready for primetime; I heard that MS is going to kill
VB.net

-Aaron

> Then it requires the user to own a copy of Access, which may not be the
> case for who this software is being targeted to.
[quoted text clipped - 41 lines]
> > >
> > > I am using VS 2003.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.