DataGrid not Updating

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2006
Posts: 32
Reputation: schmidty169 is an unknown quantity at this point 
Solved Threads: 0
schmidty169's Avatar
schmidty169 schmidty169 is offline Offline
Light Poster

DataGrid not Updating

 
0
  #1
Dec 8th, 2008
I've tried various things to get the datagrids to update. If I close the application and reload it then I see the changes to the database. If I do a transactions I don't see them until I reload it. This is where I currently left off.
  1. bank_Account_DatabaseDataSet.GetChanges();
  2. bank_Account_DatabaseDataSet.Savings.AcceptChanges();
  3. this.savingsTableAdapter.Fill(this.bank_Account_DatabaseDataSet.Savings);
  4. savDtGrdVw.Refresh();
  5. savDtGrdVw.Update();
just on the savings because until I can get it to work for one grid, no sense of playing with the other. I also tried to run my closeDatabase and getDatabase() methods. That didn't work. I've included the whole application and the database in the zip.
Attached Files
File Type: zip 0804A_IT466_DavidSchmidtII_Unit8_Bank_Acct_DB.zip (362.8 KB, 11 views)
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways - Chardonnay in one hand - chocolate in the other - body thoroughly used up, totally worn out and screaming "WOO HOO, What a Ride"
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,943
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 279
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: DataGrid not Updating

 
0
  #2
Dec 8th, 2008
Are you using M V C#2008 Express?
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 32
Reputation: schmidty169 is an unknown quantity at this point 
Solved Threads: 0
schmidty169's Avatar
schmidty169 schmidty169 is offline Offline
Light Poster

Re: DataGrid not Updating

 
0
  #3
Dec 8th, 2008
Yes I'm using Microsoft Visual C# Express 2008.
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways - Chardonnay in one hand - chocolate in the other - body thoroughly used up, totally worn out and screaming "WOO HOO, What a Ride"
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,943
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 279
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: DataGrid not Updating

 
0
  #4
Dec 8th, 2008
Well the database in your project is not always the same! There is a copy of it in a bin folder I believe. I don't know exactly how it was, but I will look it up and let you know something as soon as possible.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,943
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 279
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: DataGrid not Updating

 
0
  #5
Dec 8th, 2008
There is something wrong with your zip btw.
But.
I have a possible solution to your problem.(I think... Don't shoot me if it's not.)
The version of the database you see in solution explorer is not the same version of the database that is used by your application.
Instead the db of sol ex is copied to the output directory, where .exe file lives for example in .../bin/debug every time you run your app.
Set the property of your db called Copy to output directory to Copy If Newer and it should be ok.(I hope)
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 32
Reputation: schmidty169 is an unknown quantity at this point 
Solved Threads: 0
schmidty169's Avatar
schmidty169 schmidty169 is offline Offline
Light Poster

Re: DataGrid not Updating

 
0
  #6
Dec 9th, 2008
That didn't work. It doesn't matter if I point it to the root mdb, the one in Release or Debug. It will update the database in any of the three locations. I can open it in access and see the updates. But my grid view is only showing me what is loaded at run time.
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways - Chardonnay in one hand - chocolate in the other - body thoroughly used up, totally worn out and screaming "WOO HOO, What a Ride"
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,943
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 279
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: DataGrid not Updating

 
0
  #7
Dec 9th, 2008
Still figuring out your code.
Is all your editing done between BeginEdit and EndEdit?
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 32
Reputation: schmidty169 is an unknown quantity at this point 
Solved Threads: 0
schmidty169's Avatar
schmidty169 schmidty169 is offline Offline
Light Poster

Re: DataGrid not Updating

 
0
  #8
Dec 9th, 2008
Not sure I follow the question?
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways - Chardonnay in one hand - chocolate in the other - body thoroughly used up, totally worn out and screaming "WOO HOO, What a Ride"
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 1,943
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 279
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Posting Virtuoso

Re: DataGrid not Updating

 
0
  #9
Dec 10th, 2008
A DataGridView has BeginEdit, EndEdit and CommitEdit methods. Check these out on MSDN.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 32
Reputation: schmidty169 is an unknown quantity at this point 
Solved Threads: 0
schmidty169's Avatar
schmidty169 schmidty169 is offline Offline
Light Poster

Re: DataGrid not Updating

 
0
  #10
Dec 10th, 2008
I looked a little at the BeginEdit (still going to read a little more), but I would say no I'm doing any editing with the DataGrid so I'm not using BeginEdit, EndEdit and CommitEdit methods. I'm using statements like
  1. DBcmd.CommandText = "INSERT INTO Savings VALUES('" + System.DateTime.Now.ToString() + "','" + transaction + "','" + amountTxtBx.Text + "','" + retrieveBalance + "')";
  2. try
  3. {
  4. int row_affected = DBcmd.ExecuteNonQuery();
  5. }
To inject the changes directly into the database. I also was thinking I could get tricky last night. Figuring when I close the application and open it up the DataGrid loads the database fine. So I tried to create a second form form, putting a DataGrid on it. That way I can load and close it, maybe it would do the same thing as closing and opening the main form, and nope it doesn't. I did a copy and paste of the existing DataSet and adapters. So today I'm going to create it new out of the box.
Life should NOT be a journey to the grave with the intention of arriving safely in an attractive and well preserved body, but rather to skid in sideways - Chardonnay in one hand - chocolate in the other - body thoroughly used up, totally worn out and screaming "WOO HOO, What a Ride"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC