Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating and Inserting
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Updating and Inserting
Miscellaneous
Thread ID:
00859538
Message ID:
00859538
Views:
57
I don't understand why my update code isn't updating (and my insert code isn't inserting)...
Can someone explain to me why?

I have a form where I let the DataAdapter wizard create to code to update the Northwind Employees table.
On my form I display all the fields of the table.
I edit the last name field changing "Brown" into "Brown_10"
I supply parameter statements for all the fields (except EmployeeID - when I supply that one I get an error saying it's not part of the parameters collection - why is that????)

Here's my wizard generated DataAdapter Update code
UPDATE Employees SET
   Address = ?, BirthDate = ?, City = ?, Country = ?, Extension = ?, 
FirstName = ?, HireDate = ?, HomePhone = ?, LastName = ?, Notes = ?, 
Photo = ?, PostalCode = ?, Region = ?, ReportsTo = ?, Title = ?, 
TitleOfCourtesy = ?
WHERE     (EmployeeID = ?) AND (Address = ? OR
                      ? IS NULL AND Address IS NULL) AND (BirthDate = ? OR
                      ? IS NULL AND BirthDate IS NULL) AND (City = ? OR
                      ? IS NULL AND City IS NULL) AND (Country = ? OR
                      ? IS NULL AND Country IS NULL) AND (Extension = ? OR
                      ? IS NULL AND Extension IS NULL) AND (FirstName = ?) AND (HireDate = ? OR
                      ? IS NULL AND HireDate IS NULL) AND (HomePhone = ? OR
                      ? IS NULL AND HomePhone IS NULL) AND (LastName = ?) AND (Photo = ? OR
                      ? IS NULL AND Photo IS NULL) AND (PostalCode = ? OR
                      ? IS NULL AND PostalCode IS NULL) AND (Region = ? OR
                      ? IS NULL AND Region IS NULL) AND (ReportsTo = ? OR
                      ? IS NULL AND ReportsTo IS NULL) AND (Title = ? OR
                      ? IS NULL AND Title IS NULL) AND (TitleOfCourtesy = ? OR
                      ? IS NULL AND TitleOfCourtesy IS NULL)
In my testing I know I'm dealing with the record for EmployeeID = 10, so I've even tried simplifying the generated code to:
UPDATE Employees SET
   Address = ?, BirthDate = ?, City = ?, Country = ?, Extension = ?, 
FirstName = ?, HireDate = ?, HomePhone = ?, LastName = ?, Notes = ?, 
Photo = ?, PostalCode = ?, Region = ?, ReportsTo = ?, Title = ?, TitleOfCourtesy = ?
WHERE     (EmployeeID = 10)
Thanks,

Rick Liebespach
http://www.omniagroup.com
http://www.careermaze.com
Next
Reply
Map
View

Click here to load this message in the networking platform