How can I avoid duplicate primary key error when I use DetailsView Inserting that the field column is one of the primary key ?
Thanks in advance !
stephen
Before insertin the new row, you can check the table to see whether there is a row in the table with the same key value as the new row. For example:
if exists (select * from Orders where OrderID=@.newOrderID)
//not insert
else //insert
|||Can you show me the detail of correct syntax ? I'm very new in ASP.NET 2.0. I did type the statement in the ??.aspx.cs and syntax error found.
stephen
|||Sorry I forgot to say: the code in my last post is T-SQL statements, so you can use them in SqlCommand or something else.
No comments:
Post a Comment