Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 4th, 2003, 10:34 PM
Authorized User
 
Join Date: Oct 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Simple Database Question

I am relaively new to VB.NET and very new to Database type programming. I have a very simple problem that I can't find a SIMPLE solution to. Maybe there isn't one...

I have a DataGrid on a form that I have had no problem populating using an existing MDB file. I am using an OleDbDataApapter, an OleDbDataConnection as well as a DataSet.

I have the DataGrid being populated when the form loads. At this point, I can edit the entries in the DataBase. When I exit the form, the changes are not saved.

Is there a simple property or line or two of code that automatically saves ALL changes made to the DataBase? My apologies for my ignorance, and my thanks for any help!

 
Old December 5th, 2003, 02:10 AM
Authorized User
 
Join Date: Nov 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I assume you used the DataGrid properties to add an edit capability. To save the data you need to add an an event handler. Then, when the grid row is in edit mode, the leftmost column contains an update link. When the user clicks the update link it raises an UpdateCommand event. Write the code in that handler.
1. Click the events button at the top of the properties window.
2. Double-click the update command. A DataGrid1_Update1Command handler is added. Add code there.

HtH


Sandra MacGregor
 
Old December 8th, 2003, 05:43 PM
Authorized User
 
Join Date: Oct 2003
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Sandra,

I have ended up using XML. The database is quite small so I can do away with it. It leaves me options for exchanging the data between a couple of applications too.

Probably sac religious in programming circles but...
:-)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple question VBAprutser VB How-To 2 August 20th, 2007 06:00 AM
Very Simple Question YoungLuke C# 2 May 4th, 2007 02:23 AM
Simple Question dpkbahuguna Java Basics 2 May 19th, 2006 12:05 AM
Simple question maximus101 Classic ASP Basics 2 October 18th, 2005 10:22 PM
Simple Question dinosaur_uk VB.NET 2002/2003 Basics 1 September 10th, 2004 09:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.