Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid Update to Access 2007 problem

Status
Not open for further replies.

YvonneTsang

Programmer
Sep 28, 2001
37
CA
I am working on a simple inventory problem and I am having some problems with the update portion.

My query consists of an Inner Join between 2 tables( item details and the inventory). There is a relationship between the 2 tables

The information loads into the DataGrid properly and I can edit it fine. I am just not able to save the information back to the database correctly.

it is loaded with

this.figure_Details_QueryTableAdapter.Fill(this.hDataSet.Figure_Details_Query);

in the page load and later tries to save with

private void Save()
{
try
{
this.figure_Details_QueryTableAdapter.Adapter.Update(this.hDataSet.Figure_Details_Query);
MessageBox.Show("Save worked");
}
catch (System.Exception ex)
{
MessageBox.Show("Save didnt work: " + ex.Message.ToString());
}
}

I want it to just update the inventory part. The item details are read only.
 
error message? stack trace? having some problems doesn't help us diagnos the problem.

remove the try/catch block and post the exception details.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
I figured out the problem. The default update didnt do what I wanted. Once I played with it a bit, I got it to work properly.
 
ok I thought I had the problem fixed but I was wrong. There are no longer any error messages when I try to run the up but the database does not upload correctly. I thought I had the problem solved because the data would be updated if I ran the program after I did a save but I think the information was just not released properly. help!
 
you need to set a break point on the save event and step through each line of code. examine the contents of each object and which methods/events are called.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
have you also checked if you have the correct insert/update/delete commands on your adapter?

[wink]
 
I figured out the problem. It seems it was writing to the database correctly. The problem is that the data source was set as "copy every time" and it kept overwriting the data I would input in and hence it would look like it never got written.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top