You can use plan (b) if you focus on efficiency...
Use DataReader for better performance...
--
Best Regards,
Jan Yeh
MVP - Windows CE.NET, MCSD.NET, .NETcf consultant
Web -
http://www.mobilemind.com.tw , Blog -
http://blog.mvpcn.net/janyeh
"jayderk" <(E-Mail Removed)> ¼¶¼g©ó¶l¥ó·s»D:%(E-Mail Removed)...
> Since this is not supported in SQLCE
> "IF NOT EXISTS (SELECT customer_id FROM customer WHERE customer_id =
> '{0}')
> INSERT INTO customer(customer_id,event_id) VALUES('{0}','{1}')
>
> what is the recommended way of inserting new rows in the database with a
> focus on efficiency?
> a) do a try catch on the INSERT statement, if it fails do an UPDATE?
> b) check if customer_id exists before trying to INSERT?
>
> customer_id is a primary key
>
>
> thanks in advanced.
> Jay
>
>