My .NET 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 a newbie to .NET development. However, another developer created the
SQL Server database. The database developer set a varchar column as the
primary key within the table on which my dataset is based. The table also has
an Identity column and, as a test, if I temporarily drop 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. 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
.
.
.
End Try
What can I change within my code so that it will work with the varchar
column set as the primary key?
Ralph - 16 Sep 2007 06:08 GMT
> My .NET SqlClient dataset throws the following runtime error when trying to
> update rows in a SQL Server table:
<snipped>
You can find a complete list of managed (dotNet) newsgroups here:
http://msdn.microsoft.com/subscriptions/managednewsgroups/list.aspx