G
Guest
I am somewhat of a newbie to .NET development and my SqlClient dataset throws
the following runtime error when trying to update rows in a SQL Server table:
Dynamic SQL generation for the UpdateCommand is not supported against
a SelectCommand that does not return any key column information.
I am using a SQL Server database that someone else has developed. The table
on which my dataset is based uses a varchar column as the primary key. The
table also has an Identity column and, as a test, if I temporarily remove the
primary key from the varchar column, and re-apply the primary key against the
Identity column, the error no longer occurs. The developer of the database
will not allow this to be a permanent change, so I must reset the varchar
column as the primary key. The error occurs within the following snippet of
code:
Try
Dim cb As New SqlCommandBuilder(dataAdapterObj)
dataRowObj.BeginEdit()
dataRowObj("Image_Column") = Me.OCX_control.Image
dataRowObj.EndEdit()
dataAdapterObj.Update(dataSetObj, "History_Table")
cb.Dispose()
cb = Nothing
Catch xSQL As System.Data.SqlClient.SqlException
the following runtime error when trying to update rows in a SQL Server table:
Dynamic SQL generation for the UpdateCommand is not supported against
a SelectCommand that does not return any key column information.
I am using a SQL Server database that someone else has developed. The table
on which my dataset is based uses a varchar column as the primary key. The
table also has an Identity column and, as a test, if I temporarily remove the
primary key from the varchar column, and re-apply the primary key against the
Identity column, the error no longer occurs. The developer of the database
will not allow this to be a permanent change, so I must reset the varchar
column as the primary key. The error occurs within the following snippet of
code:
Try
Dim cb As New SqlCommandBuilder(dataAdapterObj)
dataRowObj.BeginEdit()
dataRowObj("Image_Column") = Me.OCX_control.Image
dataRowObj.EndEdit()
dataAdapterObj.Update(dataSetObj, "History_Table")
cb.Dispose()
cb = Nothing
Catch xSQL As System.Data.SqlClient.SqlException