my problem is that when i m inserting records for the first time its working but when i m editing record at that time its giving problem.
i am not able to edit any value against that pancard.
You forget to mention about method you're using to edit (update) records. Seems, you are using only
INSERT
statement. To work with databases, you have to use several operations, which have common name:
CRUD[
^].
To insert (create) data, use
INSERT[
^] statement
To read data, use
SELECT[
^] statement
To update (edit) data, use
UPDATE[
^] statement
To delete data, use
DELETE[
^] statement.
To avoid duplicates, you have to check if record exists! See:
EXISTS (Transact-SQL)[
^]
Subqueries with EXISTS[
^]
Subqueries with NOT EXISTS[
^]
IF...ELSE (Transact-SQL)[
^]
For further details, please see:
SQL: If Exists Update Else Insert – Jeremiah Clark's Blog[
^]