Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / September 2007



Tip: Looking for answers? Try searching our database.

UpdateCommand is not supported against a SelectCommand

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joannie - 16 Sep 2007 01:20 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.