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,055 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
  • 2
3 Comments
 
LVL 25

Expert Comment

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

Author Comment

by:bman9111
Comment Utility
yes it does
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now