Re: detecting same records
You should setup up your database tables correctly with primary keys, then its just a matter of trapping the error that occurs when you try to add a duplicate key in the program.
Re: detecting same records
You can do like the previous poster said or you can run a quick query on your table looking for the ID you are trying to enter. Then return a boolean value if it is there or not.
Re: detecting same records
Quote:
Originally Posted by Besoup
You can do like the previous poster said or you can run a quick query on your table looking for the ID you are trying to enter. Then return a boolean value if it is there or not.
True, however primary keys are there for a reason. It would be considered 'more correct' to set up keys, because even if you were manually entering the data into the table (through the SQL Server interface or Access, etc) the keys would prevent accidental duplicates, where as being dependent on the program would not.
Re: detecting same records
I agree with your method.. was just offering a work around.
Re: detecting same records
i already have the primary key. can u give me an example program about ths
Re: detecting same records
Quote:
Originally Posted by mheiy
i already have the primary key. can u give me an example program about ths
Here is the example.
Quote:
Originally Posted by crptcblade
You should setup up your database tables correctly with primary keys, then its just a matter of trapping the error that occurs when you try to add a duplicate key in the program.
Just trap the error when it occurs and display an appropriate message box.