This is a migrated thread and some comments may be shown as answers.

[Solved] How to restrict inserting duplicate record

4 Answers 279 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeru Catli
Top achievements
Rank 1
Jeru Catli asked on 02 Sep 2009, 03:39 AM
Hi,
    Im using stored procedure in inserting new record in my radgrid, is there a way to prompt the user if he enters duplicate record? im thinking there's a label inside the radgrid, when the user try to enter duplicate record it will change the status to 'Record is already existing'. Thanks in advance.

Jeru

4 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 02 Sep 2009, 02:43 PM
If you are already using a stored procedure I would recommend that you just check if the primary key already exists in the DB through another stored procedure that simply looks for the key that you are given. If you insert the new record after the user enters information this should be easily taken care of since you can just call this procedure before you attempt to insert.
0
Charlie Crawford
Top achievements
Rank 1
answered on 04 Sep 2009, 02:18 AM
If you are binding the radgrid to a datasource, try searching the datasource for matching records before adding new records.

By the way, your question was a little confusing in that it sounds like you are using a stored procedure to insert a record into the radgrid, but I think you are more than likely using a stored procedure to insert new records into a database after it has been entered into the radgrid.

Remember to validate all user input, and this includes searching for records that already exist.
0
Jeru Catli
Top achievements
Rank 1
answered on 04 Sep 2009, 09:23 AM
"Remember to validate all user input, and this includes searching for records that already exist. "

How to search duplicate records that already exist when clicking 'insert' command? thanks.
0
Charlie Crawford
Top achievements
Rank 1
answered on 04 Sep 2009, 10:55 AM
that depends on what you;re using as a datasource. If it's a dataset, you could use the dataset's Select method. If you need to search the database, you can build a stored procedure to search for matching records... there's so many ways you can do this and that's really more of a general programming issue than a Telerik issue. You would basically search for existing records the same way as if you were using any other control to display your data.
Tags
Grid
Asked by
Jeru Catli
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Charlie Crawford
Top achievements
Rank 1
Jeru Catli
Top achievements
Rank 1
Share this question
or