Hi guys,
I'm trying to add a record in an SQL statement through an SqlCommand into an Sql table. This table has an Autonumber (ID) and is returning an error as soon as I try to add the record through ASP.Net (C#)
This is generating the following error:Code:"INSERT INTO indicators(client_id, language_id, type, " + "location, sub_type, sub_type_desc, sub_type_category, used) " + "VALUES ('" + txtCust.Text + "','" + txtLanguage.SelectedValue + "','" + txtType.SelectedValue + "','" + txtLocation.SelectedValue + "','" + txtSubType.SelectedValue + "','" + txtSubDesc.Text + "','" + txtSubCat.Text + "','" + txtUsed.SelectedValue + "')" + " SELECT * FROM indicators"
My SQL knowledge is very basic so can anyone please help me on this one?Violation of PRIMARY KEY constraint 'PK_indicators'. Cannot insert duplicate key in object 'indicators'. The statement has been terminated.
Thanks in advance!
Vincent




Reply With Quote