PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Data Set Changes and Image importing
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Data Set Changes and Image importing
![]() |
Data Set Changes and Image importing |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi!
I'm trying to check in the OnFormClosing event if the dataset has changes that are still not commited and if yes to display a dialog box showing a question if the user wants to save tha changes or not. I test it with dataset.HasChanges() but it returns true even only when i change the record with binding navigator... Does anybody know how to do this right?? Also how can i load a picture in the database and display it in a imagecontrol? Thanks!!! |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Radi,
if (((DataSet)employeesBindingSource.DataSource).HasChanges() ) { MessageBox.Show("There are changes"); if (northwindDataSet.HasChanges() ) { MessageBox.Show("There are changes"); Both work fine for me. I hope this helps, Cor "Radi Radichev" <radi.radichev@uni-jena.de> schreef in bericht news:OxqToSuLGHA.2628@TK2MSFTNGP15.phx.gbl... > Hi! > I'm trying to check in the OnFormClosing event if the dataset has changes > that are still not commited and if yes to display a dialog box showing a > question if the user wants to save tha changes or not. I test it with > dataset.HasChanges() but it returns true even only when i change the > record > with binding navigator... Does anybody know how to do this right?? Also > how > can i load a picture in the database and display it in a imagecontrol? > Thanks!!! > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Yeah I've tryed this. It still doesn't work correct.. When i change the
record with binding navigator without editing something it still gives me that there are changes in the dataset... I'm testing it exactly as you describe: if(ds.HasChanges()) { ..... } Any ideas? "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message news:OZ1XTOvLGHA.1312@TK2MSFTNGP09.phx.gbl... > Radi, > > if (((DataSet)employeesBindingSource.DataSource).HasChanges() ) { > MessageBox.Show("There are changes"); > > if (northwindDataSet.HasChanges() ) { > MessageBox.Show("There are changes"); > > Both work fine for me. > > I hope this helps, > > Cor > > "Radi Radichev" <radi.radichev@uni-jena.de> schreef in bericht > news:OxqToSuLGHA.2628@TK2MSFTNGP15.phx.gbl... >> Hi! >> I'm trying to check in the OnFormClosing event if the dataset has changes >> that are still not commited and if yes to display a dialog box showing a >> question if the user wants to save tha changes or not. I test it with >> dataset.HasChanges() but it returns true even only when i change the >> record >> with binding navigator... Does anybody know how to do this right?? Also >> how >> can i load a picture in the database and display it in a imagecontrol? >> Thanks!!! >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Radi,
Than you should show more code, I gave you two working tested samples, I can really not look at your code without that you show it to me. Cor "Radi Radichev" <radi.radichev@uni-jena.de> schreef in bericht news:O4qSXsyLGHA.2668@tk2msftngp13.phx.gbl... > Yeah I've tryed this. It still doesn't work correct.. When i change the > record with binding navigator without editing something it still gives me > that there are changes in the dataset... I'm testing it exactly as you > describe: > if(ds.HasChanges()) > { > .... > } > Any ideas? > > > "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message > news:OZ1XTOvLGHA.1312@TK2MSFTNGP09.phx.gbl... >> Radi, >> >> if (((DataSet)employeesBindingSource.DataSource).HasChanges() ) { >> MessageBox.Show("There are changes"); >> >> if (northwindDataSet.HasChanges() ) { >> MessageBox.Show("There are changes"); >> >> Both work fine for me. >> >> I hope this helps, >> >> Cor >> >> "Radi Radichev" <radi.radichev@uni-jena.de> schreef in bericht >> news:OxqToSuLGHA.2628@TK2MSFTNGP15.phx.gbl... >>> Hi! >>> I'm trying to check in the OnFormClosing event if the dataset has >>> changes >>> that are still not commited and if yes to display a dialog box showing a >>> question if the user wants to save tha changes or not. I test it with >>> dataset.HasChanges() but it returns true even only when i change the >>> record >>> with binding navigator... Does anybody know how to do this right?? Also >>> how >>> can i load a picture in the database and display it in a imagecontrol? >>> Thanks!!! >>> >> >> > > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Oh well here's my code:
private void frmPersonal_FormClosing(object sender, FormClosingEventArgs e) { if (this.transcoDataSet.GetChanges()!=null) { DialogResult result; result = MessageBox.Show(this, "blabla", "blablaba", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); if (result == DialogResult.Yes) { this.Validate(); this.personalBindingSource.EndEdit(); this.personalTableAdapter.Update(this.transcoDataSet.personal); this.transcoDataSet.AcceptChanges(); } else if (result == DialogResult.No) e.Cancel = false; else if (result == DialogResult.Cancel) e.Cancel = true; } } |
|
|
|
#6 |
|
Guest
Posts: n/a
|
Ahm there is a mistake here..
its if(this.transcoDataSet.HasChanges())----- "Radi Radichev" <radi.radichev@uni-jena.de> wrote in message news:%23fykTX8LGHA.3196@TK2MSFTNGP09.phx.gbl... > Oh well here's my code: > private void frmPersonal_FormClosing(object sender, FormClosingEventArgs > e) > > { > > if (this.transcoDataSet.GetChanges()!=null) > > { > > DialogResult result; > > result = MessageBox.Show(this, "blabla", "blablaba", > MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, > MessageBoxDefaultButton.Button3); > > if (result == DialogResult.Yes) > > { > > this.Validate(); > > this.personalBindingSource.EndEdit(); > > this.personalTableAdapter.Update(this.transcoDataSet.personal); > > this.transcoDataSet.AcceptChanges(); > > } > > else if (result == DialogResult.No) > > e.Cancel = false; > > else if (result == DialogResult.Cancel) > > e.Cancel = true; > > } > > } > > > > |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Radi,
Can you try this one transcoDataSet.Tables("yourtablename or the strongly typed one).EndCurrentEdit(); > its if(this.transcoDataSet.HasChanges())----- I hope this helps Cor > its if(this.transcoDataSet.HasChanges())----- > "Radi Radichev" <radi.radichev@uni-jena.de> wrote in message > news:%23fykTX8LGHA.3196@TK2MSFTNGP09.phx.gbl... >> Oh well here's my code: >> private void frmPersonal_FormClosing(object sender, FormClosingEventArgs >> e) >> >> { >> >> if (this.transcoDataSet.GetChanges()!=null) >> >> { >> >> DialogResult result; >> >> result = MessageBox.Show(this, "blabla", "blablaba", >> MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, >> MessageBoxDefaultButton.Button3); >> >> if (result == DialogResult.Yes) >> >> { >> >> this.Validate(); >> >> this.personalBindingSource.EndEdit(); >> >> this.personalTableAdapter.Update(this.transcoDataSet.personal); >> >> this.transcoDataSet.AcceptChanges(); >> >> } >> >> else if (result == DialogResult.No) >> >> e.Cancel = false; >> >> else if (result == DialogResult.Cancel) >> >> e.Cancel = true; >> >> } >> >> } >> >> >> >> > > |
|
|
|
#8 |
|
Guest
Posts: n/a
|
Cor, I can't find such method...
Can you write this a little understandable pls? "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message news:e48XXr8LGHA.420@tk2msftngp13.phx.gbl... > Radi, > > Can you try this one > transcoDataSet.Tables("yourtablename or the strongly typed > one).EndCurrentEdit(); >> its if(this.transcoDataSet.HasChanges())----- > > I hope this helps > > Cor > >> its if(this.transcoDataSet.HasChanges())----- >> "Radi Radichev" <radi.radichev@uni-jena.de> wrote in message >> news:%23fykTX8LGHA.3196@TK2MSFTNGP09.phx.gbl... >>> Oh well here's my code: >>> private void frmPersonal_FormClosing(object sender, FormClosingEventArgs >>> e) >>> >>> { >>> >>> if (this.transcoDataSet.GetChanges()!=null) >>> >>> { >>> >>> DialogResult result; >>> >>> result = MessageBox.Show(this, "blabla", "blablaba", >>> MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, >>> MessageBoxDefaultButton.Button3); >>> >>> if (result == DialogResult.Yes) >>> >>> { >>> >>> this.Validate(); >>> >>> this.personalBindingSource.EndEdit(); >>> >>> this.personalTableAdapter.Update(this.transcoDataSet.personal); >>> >>> this.transcoDataSet.AcceptChanges(); >>> >>> } >>> >>> else if (result == DialogResult.No) >>> >>> e.Cancel = false; >>> >>> else if (result == DialogResult.Cancel) >>> >>> e.Cancel = true; >>> >>> } >>> >>> } >>> >>> >>> >>> >> >> > > |
|
|
|
#9 |
|
Guest
Posts: n/a
|
Radi,
Has to be brackets, it is a property. transcoDataSet.Tables["yourtablename"].EndCurrentEdit(); (It was some mix between C# and VBCode at the end I did remember me that you are using C#) My keyboard is broken, I have now an old one however while typing with a broken keyboard I had not much attention to the syntax, I was glad it was typing. :-) Cor "Radi Radichev" <radi.radichev@uni-jena.de> schreef in bericht news:%23kAD8I9LGHA.3144@TK2MSFTNGP11.phx.gbl... > Cor, I can't find such method... > Can you write this a little understandable pls? > > "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message > news:e48XXr8LGHA.420@tk2msftngp13.phx.gbl... >> Radi, >> >> Can you try this one >> transcoDataSet.Tables("yourtablename or the strongly typed >> one).EndCurrentEdit(); >>> its if(this.transcoDataSet.HasChanges())----- >> >> I hope this helps >> >> Cor >> >>> its if(this.transcoDataSet.HasChanges())----- >>> "Radi Radichev" <radi.radichev@uni-jena.de> wrote in message >>> news:%23fykTX8LGHA.3196@TK2MSFTNGP09.phx.gbl... >>>> Oh well here's my code: >>>> private void frmPersonal_FormClosing(object sender, >>>> FormClosingEventArgs e) >>>> >>>> { >>>> >>>> if (this.transcoDataSet.GetChanges()!=null) >>>> >>>> { >>>> >>>> DialogResult result; >>>> >>>> result = MessageBox.Show(this, "blabla", "blablaba", >>>> MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, >>>> MessageBoxDefaultButton.Button3); >>>> >>>> if (result == DialogResult.Yes) >>>> >>>> { >>>> >>>> this.Validate(); >>>> >>>> this.personalBindingSource.EndEdit(); >>>> >>>> this.personalTableAdapter.Update(this.transcoDataSet.personal); >>>> >>>> this.transcoDataSet.AcceptChanges(); >>>> >>>> } >>>> >>>> else if (result == DialogResult.No) >>>> >>>> e.Cancel = false; >>>> >>>> else if (result == DialogResult.Cancel) >>>> >>>> e.Cancel = true; >>>> >>>> } >>>> >>>> } >>>> >>>> >>>> >>>> >>> >>> >> >> > > |
|
|
|
#10 |
|
Guest
Posts: n/a
|
When I use the binding source to change the record to the next recort it
automaticly changes somehow the state to modified and when i check it with HasChanges() it gives me true every time when i look another records.. I can't find info on this in msdn.... "Radi Radichev" <radi.radichev@uni-jena.de> wrote in message news:%23kAD8I9LGHA.3144@TK2MSFTNGP11.phx.gbl... > Cor, I can't find such method... > Can you write this a little understandable pls? > > "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message > news:e48XXr8LGHA.420@tk2msftngp13.phx.gbl... >> Radi, >> >> Can you try this one >> transcoDataSet.Tables("yourtablename or the strongly typed >> one).EndCurrentEdit(); >>> its if(this.transcoDataSet.HasChanges())----- >> >> I hope this helps >> >> Cor >> >>> its if(this.transcoDataSet.HasChanges())----- >>> "Radi Radichev" <radi.radichev@uni-jena.de> wrote in message >>> news:%23fykTX8LGHA.3196@TK2MSFTNGP09.phx.gbl... >>>> Oh well here's my code: >>>> private void frmPersonal_FormClosing(object sender, >>>> FormClosingEventArgs e) >>>> >>>> { >>>> >>>> if (this.transcoDataSet.GetChanges()!=null) >>>> >>>> { >>>> >>>> DialogResult result; >>>> >>>> result = MessageBox.Show(this, "blabla", "blablaba", >>>> MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, >>>> MessageBoxDefaultButton.Button3); >>>> >>>> if (result == DialogResult.Yes) >>>> >>>> { >>>> >>>> this.Validate(); >>>> >>>> this.personalBindingSource.EndEdit(); >>>> >>>> this.personalTableAdapter.Update(this.transcoDataSet.personal); >>>> >>>> this.transcoDataSet.AcceptChanges(); >>>> >>>> } >>>> >>>> else if (result == DialogResult.No) >>>> >>>> e.Cancel = false; >>>> >>>> else if (result == DialogResult.Cancel) >>>> >>>> e.Cancel = true; >>>> >>>> } >>>> >>>> } >>>> >>>> >>>> >>>> >>> >>> >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

