i wish to update or insert if missing into an msaccess database using asp.
i was trying something like:
IF EXISTS (SELECT * FROM Table1 WHERE Column1='SomeValue')
UPDATE Table1 SET (...) WHERE Column1='SomeValue'
ELSE
INSERT INTO Table1 VALUES (...)
and
UPDATE Table1 SET (...) WHERE Column1='SomeValue'
IF @@ROWCOUNT=0
INSERT INTO Table1 VALUES (...)
INSERT or UPDATE by themselves work fine. but when i use the both with one of the methods it fails.
You cannot run two sql statements at once in Access. You must update and insert in two separate operations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With