[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Stop SqlDataAdapter Update() method

Posted on 2004-10-15
8
Medium Priority
?
335 Views
Last Modified: 2008-02-01
Hi Experts

I am updating my database using multithreading. The method used is the SqlDataAdapter.Update(). If the user presses cancel, I would like to stop the operation. For this I handle the RowUpdated event of the adapter but does anyone know how to stop the adapter Update() method?

Thanks
TheAvenger
0
Comment
Question by:TheAvenger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 8

Expert Comment

by:tomvergote
ID: 12317576
you could add an eventhandler to the dataset onupdate event
0
 
LVL 20

Author Comment

by:TheAvenger
ID: 12317582
I have the event, it's ok. How to stop the adapter? Because I catch the event, but the adapter will still go on after I handle it.
0
 
LVL 8

Expert Comment

by:tomvergote
ID: 12317639
hmm, I posted the previous comment without looking at docs or code, and apparently dataset or dataadapter doesn't have an update event.
what event are you using?

If you update through a dataset, what happens if you call a dataset.acceptchanges.
I'll be on my dev machine in a bit, i'll be able to check my posts better but for now bear with me please

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 20

Author Comment

by:TheAvenger
ID: 12317654
I can't call AcceptChanges, because this will disallow a second save attempt. I use the RowUpdated event of the data adapter and it fires just fine after every row is updated - perfect place to stop the udpate operation. The only question is how.
0
 
LVL 8

Expert Comment

by:tomvergote
ID: 12317667
sorry i meant rejectchanges
yikes
0
 
LVL 20

Author Comment

by:TheAvenger
ID: 12317675
It's the same: both AcceptChanges and RejectChanges will change the dataset so, that a second attempt to update the database will consider that no records need update. Also RejectChanges will lose everything the user made, so both don't work.
0
 
LVL 8

Accepted Solution

by:
tomvergote earned 1000 total points
ID: 12317758
according to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaddingremovingadonetproviderevents.asp

you could either cancel it with an error or skip rows (which if i understand you correctly would have the same effect as cancelling)
0
 
LVL 20

Author Comment

by:TheAvenger
ID: 12318545
Now, this was a good one!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question