December 16, 2003 at 12:51 am
How can i prevent a ADO application (Client side) to not recieve errors from SQL sever
for example i use a procedure for inserting but the user dont care for duplicate values
SQL server return a uniqe violation for the Index Its easy to do it on the client side but on the server side i always haves the message ????
December 16, 2003 at 6:51 am
Check if the key exists before inserting.
Far away is close at hand in the images of elsewhere.
Anon.
December 16, 2003 at 6:56 am
in other words :
INSERT INTO TABLE(x1,,...) VALUES (@x1,@x2,...)
WHERE TABLE.PRIMARY_KEY <> @YOUR_PRIMARY_KEY
Edited by - noeld on 12/16/2003 06:57:22 AM
* Noel
December 17, 2003 at 10:40 am
try using an *exception handler* on client side ...
best regards,
chris.
December 19, 2003 at 11:35 am
quote:
You can try to do something like this:If exists(select * from table where key = @key)
insert into table (key,...)
values (@key,...)
else
return -1
in a highly transactional enviroment a connection could insert the @id that the exists query is checking AFTER the check and BEFORE the insert. That's why you should NOT splitt the query into several if you are not using explicit Transactions!!!
* Noel
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply