J
Joey Lee
Hi,
I was wondering which is the best way of checking if a
record exist in the database before inserting.
There are quite a few ways I have seen. Here are some...
1> Insert and hit a primary key violation and then handle
it
2> Select of a dataset/datareader based on the new record
id. If the result has something in it, then don't insert
3> Change the sql statement to count(*) based on the new
record id. If count > 0 then don't insert
So, I was wondering which is the best way(most effecient
way) of doing it. or if there are better way.
Thanks
Joey
I was wondering which is the best way of checking if a
record exist in the database before inserting.
There are quite a few ways I have seen. Here are some...
1> Insert and hit a primary key violation and then handle
it
2> Select of a dataset/datareader based on the new record
id. If the result has something in it, then don't insert
3> Change the sql statement to count(*) based on the new
record id. If count > 0 then don't insert
So, I was wondering which is the best way(most effecient
way) of doing it. or if there are better way.
Thanks
Joey