6

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?

Alex
  • 2,011
  • 3
  • 21
  • 27

1 Answers1

1

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.

Darren
  • 68,902
  • 24
  • 138
  • 144
amcoder
  • 1,131
  • 9
  • 5
  • Thanks, that is a useful document. Unfortunately none of the limitations mentioned seem to apply to my code. –  Oct 14 '08 at 15:54