dataset used for databindings always returning true for GetChanges() != null even when...

I have a form that uses a dataset for a databinding...of its components.
I load info into the form, as all the examples state, then I go and load another from the list
and verify first if dataset.GetChanges!= null in order to save any changed data...always returns
true...for some reason....never did this before...the conversion 2003 to 2005.

Any ideas as to what I might be doing wrong...I can post the code....but if someone knows of any changes done to 2005 datasets that would change the databinding views....I would really appreciate a hand.
Who is Participating?
Closed, 300 points refunded.
Site Admin
hesaigo999caAuthor Commented:
ps - I have done the following DataTable dt = dataset.GetChanges();
 then compared all the values from dt to all the values that are in the compoents on the form and there are no could this be???
hesaigo999caAuthor Commented:
sorry about that that would be  DataTable dt = DataTable.GetChanges();
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Can you please post the code?
show code
Bob LearnedCommented:
What does dt.Rows.Count equal?

hesaigo999caAuthor Commented:
Form1 is for invoices which is the GUI to the dataset containing table "Invoices"
Form2 is a search form with a representation of all the invoices in the db with a tdbgrid
bound on the same doubleclicking the tdbgrid, it should load Form1 with the info for that invoice, the problem is that when I load the info into the databound components of the form, then I choose another , it tells me that the info has changed even though I have gone through great lenghts to compare the DataTable.Current with the DataTable.Orignal info to see there was no change in the data...we recently converted from 2003 to 2005
and now it seems to see the bindings is the code so far..
notice that the dataset is set globally so that all forms may see the dataset containing all the tables needed for the app...and also be able to call from one form to another based on current position....or setting based on dataset.invoices.currentposition = x;

// form2 (searchgrid) doubleclick the grid to load form1 with selected invoice
private void gridFacts_DoubleClick(object sender, System.EventArgs e)
 CurrencyManager cm = null;                     
cm = (CurrencyManager) this.BindingContext[DBComponent.dataSet,"Facturation_salle"];
if(form1.checkState()!=DialogResult.Cancel)                  form1.LoadOne(((DataSet1.Facturation_salleRow)((System.Data.DataRowView)cm.List[this.gridFacts.Row]).Row).ID_facturation_salle);

//form1 methods
public DialogResult checkState()
  {answer = MessageBox.Show("Some data has changed in 'invoice' and have not been saved. Do you wish to save before continuing?","Attention",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question);
  if(answer == DialogResult.Yes)
  { if(save()==DialogResult.Cancel) return DialogResult.Cancel;}
  else if(answer == DialogResult.No)
   return DialogResult.No;
  else if(answer == DialogResult.Cancel) {return DialogResult.Cancel;}
return DialogResult.Yes;

private void LoadOne(int id)
 sqlDataAdapterinvoice.SelectCommand.Parameters["@ID_invoice"].Value = id;
 for(int i=DBComponent.dataSet.Facturation_salle.Count-1;i>=0;i--)      
 {      if(DBComponent.dataSet.Facturation_salle[i].ID_facturation_salle == id)
         this.BindingContext[DBComponent.dataSet,"Facturation_salle"].Position = i;            
       //function looping through all form components to enable them to parameter given
       bNotes.Enabled = true;
       this.comRoute.Enabled = false;

private DialogResult save()
  DataRow updRow = Invoice.Rows[this.BindingContext[dataSet,"Invoice"].Position];
updRow["date_invoice"]=this.deDate.Value; //dateedit                       
updRow["invoiced"]=this.cbInvoiceGiven.Checked; //checkbox
updRow["reimbursment_effected"]=this.cbReimbursment.Checked; //checkbox
updRow["invoice_amount"]=this.tbAmount.Value; //textbox            

 catch(Exception me)
  return DialogResult.Cancel;
 return DialogResult.Yes;
hesaigo999caAuthor Commented:
>>What does dt.Rows.Count equal?
when I getchanges from a load through doubleclick from form2 to form1
i get 1 which is the total amount of invoices in the global dataset too!
it is the only one and I used many different ways to see the values
between the
DataRowVersion.Current & DataRowVersion.Original of each column in the row...
based on ref.

I am without any ideas at this point, other then something has changed in the way the datasets are bound and treated in 2005 compared to 2003, if I knew what they had done diff.
I could check into it more, but it is poorly documented as to what really changed
behind the scenes for .NET 2.0
hesaigo999caAuthor Commented:
here is how i tried to see diff values from original to current if needed....

DataTable dt = DBComponent.dataSet.Facturation_salle.GetChanges();
int count = dt.Rows.Count; //returned 1
DataRow dr = dt.Rows[0];
if (dr["id_invoice", DataRowVersion.Current] != dr["id_invoice", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["id_invoice", DataRowVersion.Current].ToString() + " original - " + dr["id_invoice", DataRowVersion.Original].ToString());
                    if (dr["date_reservation", DataRowVersion.Current] != dr["date_reservation", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["date_reservation", DataRowVersion.Current].ToString() + " original - " + dr["date_reservation", DataRowVersion.Original].ToString());
                    if (dr["lieu", DataRowVersion.Current] != dr["lieu", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["lieu", DataRowVersion.Current].ToString() + " original - " + dr["lieu", DataRowVersion.Original].ToString());
                    if (dr["id_etablissement", DataRowVersion.Current] != dr["id_etablissement", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["id_etablissement", DataRowVersion.Current].ToString() + " original - " + dr["id_etablissement", DataRowVersion.Original].ToString());
                    if (dr["reference_clause", DataRowVersion.Current] != dr["reference_clause", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["reference_clause", DataRowVersion.Current].ToString() + " original - " + dr["reference_clause", DataRowVersion.Original].ToString());
                    if (dr["reimbursement", DataRowVersion.Current] != dr["reimbursement", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["reimbursement", DataRowVersion.Current].ToString() + " original - " + dr["reimbursement", DataRowVersion.Original].ToString());
                    if (dr["reimbursement_percentage", DataRowVersion.Current] != dr["remboursement_pourcentage", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["reimbursement_percentage", DataRowVersion.Current].ToString() + " original - " + dr["reimbursement_percentage", DataRowVersion.Original].ToString());
                    if (dr["reimbursement_amount_max", DataRowVersion.Current] != dr["reimbursement_amount_max", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["reimbursement_amount_max", DataRowVersion.Current].ToString() + " original - " + dr["reimbursement_amount_max", DataRowVersion.Original].ToString());
                    if (dr["invoice_given", DataRowVersion.Current] != dr["invoice_given", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["invoice_given", DataRowVersion.Current].ToString() + " original - " + dr["invoice_given", DataRowVersion.Original].ToString());
                    if (dr["amount_invoice", DataRowVersion.Current] != dr["amount_invoice", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["amount_invoice", DataRowVersion.Current].ToString() + " original - " + dr["amount_invoice", DataRowVersion.Original].ToString());
                    if (dr["reimbursement_effective", DataRowVersion.Current] != dr["reimbursement_effective", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["reimbursement_effective", DataRowVersion.Current].ToString() + " original - " + dr["reimbursement_effective", DataRowVersion.Original].ToString());
                    if (dr["amount_reimbursed", DataRowVersion.Current] != dr["amount_reimbursed", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["amount_reimbursed", DataRowVersion.Current].ToString() + " original - " + dr["amount_reimbursed", DataRowVersion.Original].ToString());
                    if (dr["goal", DataRowVersion.Current] != dr["goal", DataRowVersion.Original])
                        System.Diagnostics.Debug.Print("current - " + dr["goal", DataRowVersion.Current].ToString() + " original - " + dr["goal", DataRowVersion.Original].ToString());
and this is the following output only a few columns output

id_invoice - current - 1 original - 1
date_reservation - current - 2006-05-15 00:00:00 original - 2006-05-15 00:00:00
id_etablissement - current - 1 original - 1
reimbursement - current - True original - True
reimbursement_percentage - current - 76 original - 76
reimbursement_amount_max - current - 577,0000 original - 577,0000
Bob LearnedCommented:
Is this true for all columns?

hesaigo999caAuthor Commented:
no actually it is only for a few...but i did read this post over at componentone...(we use some of their components) and their seems to be a work around for the DataRows returning false positives...
he built a quick function that processes the info and corrects it, although I dont know why microsoft did not do this for 2.0 seeing as it may have been important enough for everyone to save bandwidth using their GetChanges to check for REAL changes....!!!

I would still like to know if I am missing something from microsoft docs that may help explain this problem...
hesaigo999caAuthor Commented:
i did find this article over at msdn... but they do not go into detail as to the real why  and what should be done about it...
hesaigo999caAuthor Commented:
I have resolved my question myself based on examples from the sites I have listed above,

I am now unaware of how to retract this question, moderators please help as I
would like to close this question, I am under no obligation to award points if no one properly answered my question to solve it.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.