Solved

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information

Posted on 2007-03-29
3
1,065 Views
Last Modified: 2008-01-09
I have the following.
In my dataset I have the table listed and there is a primary key.

using System.Data.SqlClient;

Datasetname dt = new Datasetname ();
command.CommandText = "Select * from table1"
adapter.SelectCommand = command;
adapter.Fill (dt, "table1");
SqlCommandBuilder commandb = new SqlCommandBuilder(adapter);
adapter.UpdateCommand = commandb.GetUpdateCommand();

I get the error:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information

I have no idea why.
0
Comment
Question by:bman9111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 25

Expert Comment

by:dstanley9
ID: 18819837
does table1 have a primary key in the database? (not in yout dataset)
0
 
LVL 8

Author Comment

by:bman9111
ID: 18820586
yes it does
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18823240
Can you generate a CREATE script for table1 from SQL Server?  It seems that the SqlCommandBuilder is not able to determine what the primary key is.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question