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,060 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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