Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
hadoft
Starting Member
20 Posts |
Posted - 2003-10-20 : 14:23:35
|
| hithis question is about using ADODB.Command Object in Visual Basichow can i stop the execution of a ADODB.Command running a long update statmenti want to give the user the ability to cut command execution by clicking a cancel button. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-10-20 : 14:25:46
|
| You can create a new connection and issue a kill command - this will cause the transaction to rollback.You can terminate the connection but this will probably cause the update to roll back when it finishes.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-10-20 : 14:31:48
|
| Won't s/he have to know the spid?Brett8-) |
 |
|
|
hadoft
Starting Member
20 Posts |
Posted - 2003-10-20 : 14:43:30
|
quote: Originally posted by nr You can create a new connection and issue a kill command - this will cause the transaction to rollback.You can terminate the connection but this will probably cause the update to roll back when it finishes.
thanks for the quick replaybut the problem is when I execute the command the program stop execution until the command is finished and even the user can't click the canel buttonhow can i make the command execution asynchronous ?? |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-10-20 : 15:03:39
|
| Do you mean that something like below does not workor you are totally unfamiliar with that?cmd.Execute , , adAsyncExecutePrivate Sub Button1_Click()cmd.CancelEnd Sub |
 |
|
|
hadoft
Starting Member
20 Posts |
Posted - 2003-10-20 : 15:20:00
|
quote: Originally posted by Stoad Do you mean that something like below does not workor you are totally unfamiliar with that?cmd.Execute , , adAsyncExecutePrivate Sub Button1_Click()cmd.CancelEnd Sub
oh yes I will try itthanks. |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-10-21 : 04:33:07
|
| Note:if you just want to free users hands then cmd.Execute , , adAsyncExecutewill be enough. But if you really want to rollback an updating then you shouldbreak (cn.Close) the connection in which the command was issued. |
 |
|
|
|
|
|