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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Return from a query

Author  Topic 

Firefly17
Yak Posting Veteran

78 Posts

Posted - 2005-09-11 : 23:52:17
Hi

How can I know whether a query or a stored procedure is successfully executed? I mean like in delete case?
here is an example

sql_delete = "DELETE FROM UserData where U_ID='" & tempID & "'"
rstIDChk.Open sql_delete, cnn, adOpenStatic, adLockOptimistic


How can I make sure that the record is deleted so that I can proceed with other jobs? How can I catch it in the program like from VB? Is there any return like true or false in SQL? :(

Tks alot..

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-12 : 00:37:44
After executing that statement execute

rstIDChk.Open "Select @@RowCount", cnn, adOpenStatic, adLockOptimistic

if rstIDChk.fields(0)>0 then
--Some records were deleted
end if



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Firefly17
Yak Posting Veteran

78 Posts

Posted - 2005-09-12 : 01:43:26
Hi tks alot but I still have some questions..

how abt if I want to tell the user that the table is using by someone else at pt of accessing that table..

like here

rstTran.Open "Tran", cnnReLoss, adOpenStatic, adLockOptimistic

I opened the record set with lock.. so, if one user is using it, the other can't modify ( am I right? If I were wrong, pls correct me :( ).. I used to get message like table is used by other prg or sth like that. But I have to tell the user with a userfriendly message and quit that routine. How can I do it? How can i know if someone is using that table at that opening state?

Go to Top of Page
   

- Advertisement -