?
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
Medium Priority
?
1,068 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

719 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