views:

391

answers:

1

I have a database table with 6 columns. The primary key is a composite key made up of 5 of the 6 columns

I am trying to use the SqlClient.SqlCommandBuilder.GetDeleteCommand to delete the row.

However I am getting the following error: "System.InvalidOperationException : Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information."

The SelectCommmand contains all the columns in the table:

SELECT TABLENAME.COL1, TABLENAME.COL2, TABLENAME.COL3, TABLENAME.COL4, 
TABLENAME.COL5, TABLENAME.COL6 from TABLENAME

Could the problem be the composite key?

A: 

I don't think your problem is the composite key. According to the documentation, the primary key does not have to be a single column. there are other limitations that are required to automatically generate statements though. Try reading through this document to verify that you haven't missed anything.

amcoder
Thanks, that is a useful document. Unfortunately none of the limitations mentioned seem to apply to my code.

related questions