C
Chris Clement
I am trying to update a record in a SQL database through a web service but
am getting this error:
System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint
'PK_Items'. Cannot insert duplicate key in object 'VideoProposalItems'.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at proposalWebService.Service2.setVideoProposalItemsData(String strPass,
Byte[] compressedData) in
c:\inetpub\wwwroot\proposalwebservice\service2.asmx.cs:line 757
line 757: sqlDataAdapter2.Update(DataSet1,"Items");
This record already exists but for some reason the Update method is trying
to insert a new record rather than update the current one. What makes the
Update method decide whether to use insert or update?
Chris
am getting this error:
System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint
'PK_Items'. Cannot insert duplicate key in object 'VideoProposalItems'.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at proposalWebService.Service2.setVideoProposalItemsData(String strPass,
Byte[] compressedData) in
c:\inetpub\wwwroot\proposalwebservice\service2.asmx.cs:line 757
line 757: sqlDataAdapter2.Update(DataSet1,"Items");
This record already exists but for some reason the Update method is trying
to insert a new record rather than update the current one. What makes the
Update method decide whether to use insert or update?
Chris