I have a .NET 2.0 C# guestbook like web application that uses a SQL Microsoft Server database and
trying to prevent duplicate records from being inserted with this InsertCommand in my C# .NET code
But I get an error indicating that there is something wrong near the WHERE?
InsertCommand="INSERT INTO Table_1 (First_Name, Last_Name,@Pay_Number)
WHERE NOT EXIST (SELECT Last_Name FROM Table_1 T1 WHERE T1.Pay_Number= Pay_Number AND T1.Person_ID = Person_Id)"
User enters his or her's First_Name, Last_Name and Pay_Number into 3 textboxes
This is how I note them in the Insert statement above---> @First_Name,@Last_Name,@Pay_Number
I have 1 single table that looks something like this:
(primary key) person_Id int
The primary key "person_Id" is auto generated by the sql server and not returned to my C# .NET application or displayed or used anywhere that I know.
Help me fix the problem in my InsertCommand= statement above.