OK, that worked and i was able to update the information in the database, but now i have another problem... "NullReferenceException was unhandled", "Object reference not set to an instance of an object"
Main Topics
Browse All TopicsI am having a problem updating information to a MS Access Database.
Before i code this much more, i simply have a link to a MS Access Database, a DataGridView, a TextBox, and a Button on Form1.
The database is linked and when running the program it pulls the columns from the database and populates the DataViewGrid. This DataViewGrid will not allow changes, i want the changes to occur in textboxs and that information then updated back to the database.
i am able to make the DataGridView change with the updated information from Textbox1, however that information is not being written back to the actual database and i can't seem to figure out why..
The code below is my source code for all of Form1, and Button1_Click.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Try
Dim TempTable As DataTable = Database1DataSet.CSVFILE
I suggest using bindingsource instead of DataTables
'********Can be set in design time**********
dim bsCSVFILE As New BindingSource
bsCSVFILE.DataSource = Database1DataSet
bsCSVFILE.DataMember="CsvF
'*********************
dim drv As DataRowView=bsCSVFILE..Add
drv("DOS") = "2009-07-08"
drv("LOS") = "BLS"
drv("PTNAME") = "DOE, JOHN"
bsCSVFILE.EndEdit
Me.CSVFILETableAdapter.Upd
Your Solution worked prefectly!
I will update the "Accept Solutions" shortly,
If you able to, i am also in need of a few other specifics with this same database.
1. Update an existing row/cell in the row
2. Delete the row
Your help is greatly appreciated, i havent worked with programming in many years and so much of the syntax and funcations have changed. Last time i worked with programming, the database interface was "recordset..." VB '97
Thank you very much
Hi
The .net database approach is slightly different then old VB. Then main idea is:
1. Connect to database, get info (TableAdapter(s).Fill), disconnect
2. Working with dataset (like database mirror) - adding new records, modifying, deleting in memory
3. Finally - connect to database again, update changes (tableAdapter(s).Update), disconnect.
3.1 Dataset.GetChanges gives changed records
3.2 Dataset.AcceptChanges marks those records as unchanged to repeat 2-3 steps
So, if using BindingSourse(s):
1. Connect to DB (Fill adapters)
2. set bindingsource(s) DataSource(=DataSet) and DatatMember(s)(=TableName(
3. Work wit bindingsourse(s)
3.1. Navigate: bs.Position=bs.Find("LOS",
3.2 Add New (see my previous post)
3.3 Change Cells: bs("PTNAME")="whatever", bs("otherColumn") = "newString"
3.4 Delete bs.DeleteCurrent (or bs.Delete(bs(bs.Find("LOS"
3.4. Accept (bs.EndEdit) or discard (bs.CancelEdit) in-memory changes
4. Update DataBase (TableAdapter.Update)
Business Accounts
Answer for Membership
by: ArkPosted on 2009-07-08 at 15:39:14ID: 24809179
Me.CSVFILETableAdapter.Upd ate(YourDa taSetNameH ere)