TableAdapter Problem

G

GaryDean

I'm comparing use of DataView -> ObjectDataSource -> TableAdapter to
DataView -> SqlDataSource using the Customers table on the NorthWind
database.

The SQL given to both wizards is:
SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address,
City, Region, PostalCode, Country, Phone, Fax
FROM Customers

But the two wizards generate different UPDATE statements (Pasted below) and
I see the TableAdapter is trying to set the CustomerID Key which looks
wrong. The problem here is that the TableAdapter does not work saying that
it can't fine a generic Update statement with the correct parameters.

Why is the TableAdapter wizard generating bad Update SQL ??

ObjectDataSource:
UPDATE Customers SET CustomerID = @CustomerID, CompanyName =
@CompanyName, ContactName = @ContactName, ContactTitle = @ContactTitle,
Address = @Address, City = @City, Region = @Region, PostalCode =
@PostalCode, Country = @Country, Phone = @Phone, Fax = @Fax
WHERE (CustomerID = @Original_CustomerID)

SqlDataSource:
UPDATE [Customers] SET [CompanyName] = @CompanyName, [ContactName] =
@ContactName, [ContactTitle] = @ContactTitle,
[Address] = @Address, [City] = @City, [Region] = @Region, [PostalCode] =
@PostalCode, [Country] = @Country, [Phone] = @Phone, [Fax] = @Fax
WHERE [CustomerID] = @CustomerID">
 
S

Steven Cheng[MSFT]

Hello Gary,

Thanks for your posting.

Regarding on this issue, I've noticed that you've posted another duplicated
thread

"TableAdapter generates bad SQL" in the following newsgroup:

microsoft.public.dotnet.framework.adonet

Our member Kevin has replied you in that thread and will continue to work
with you there. I'd appreciate if you have a look there, and if you have
any further questions, please feel free to post there.

Thanks for your understanding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top