473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Simple GridView Problem

I'm trying to do something very straightforward in a 2.0 asp.net app with a
GridView - ObjectDataSource - DataSet.

I create a DataSet that accesses the NorthWind Customers Table - all columns
and I choose to generate all methods and updates. I connect this DataSet to
an ObjectDataSource and connect my DataView to the ObjectDataSource. (I did
not opt for optimistic concurrency) It displays just fine. Then I try to
change an address field in a row and get the error pasted below. The update
command that was generated is also pasted below. This is stuff right out of
textbooks. What is wrong?

Thanks,
T

ObjectDataSource 'ods2' could not find a non-generic method 'Update' that
has parameters: CompanyName, ContactName, ContactTitle, Address, City,
Region, PostalCode, Country, Phone, Fax, original_CustomerID.
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)
Jul 25 '06 #1
3 2148
Ron
"Tina" <Ti**********@nospamexcite.comwrote in message
news:ek****************@TK2MSFTNGP03.phx.gbl...
I'm trying to do something very straightforward in a 2.0 asp.net app with
a GridView - ObjectDataSource - DataSet.

I create a DataSet that accesses the NorthWind Customers Table - all
columns and I choose to generate all methods and updates. I connect this
DataSet to an ObjectDataSource and connect my DataView to the
ObjectDataSource. (I did not opt for optimistic concurrency) It displays
just fine. Then I try to change an address field in a row and get the
error pasted below. The update command that was generated is also pasted
below. This is stuff right out of textbooks. What is wrong?

Thanks,
T

ObjectDataSource 'ods2' could not find a non-generic method 'Update' that
has parameters: CompanyName, ContactName, ContactTitle, Address, City,
Region, PostalCode, Country, Phone, Fax, original_CustomerID.
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)
Hi Tina.
The problem could be caused by an incorrect setting in your
ObjectDataSource.Have you made sure the ObjectDataSource is configured not
to send original values together with your own parameters?
The ObjectDataSource OldValuesParameterFormatString property should not be
set if you want to send only your own parameters.
HTH
Ron.
Jul 25 '06 #2
OldValuesParameterFormatString was set to Original_{0} so I set it to blank
and the same thing happens.
T

"Ron" <no***@nowhere.comwrote in message
news:ea**************@TK2MSFTNGP02.phx.gbl...
"Tina" <Ti**********@nospamexcite.comwrote in message
news:ek****************@TK2MSFTNGP03.phx.gbl...
>I'm trying to do something very straightforward in a 2.0 asp.net app with
a GridView - ObjectDataSource - DataSet.

I create a DataSet that accesses the NorthWind Customers Table - all
columns and I choose to generate all methods and updates. I connect this
DataSet to an ObjectDataSource and connect my DataView to the
ObjectDataSource. (I did not opt for optimistic concurrency) It displays
just fine. Then I try to change an address field in a row and get the
error pasted below. The update command that was generated is also pasted
below. This is stuff right out of textbooks. What is wrong?

Thanks,
T

ObjectDataSource 'ods2' could not find a non-generic method 'Update' that
has parameters: CompanyName, ContactName, ContactTitle, Address, City,
Region, PostalCode, Country, Phone, Fax, original_CustomerID.
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)

Hi Tina.
The problem could be caused by an incorrect setting in your
ObjectDataSource.Have you made sure the ObjectDataSource is configured not
to send original values together with your own parameters?
The ObjectDataSource OldValuesParameterFormatString property should not be
set if you want to send only your own parameters.
HTH
Ron.

Jul 25 '06 #3
Ron

"Tina" <Ti**********@nospamexcite.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
OldValuesParameterFormatString was set to Original_{0} so I set it to
blank and the same thing happens.
T
<snip>
OK, Tina.
Try removing the CustomerID = @CustomerID from your parameter list.
I wonder why you are using an ObjectDataSource and a DataSet when normally
an SqlDataSource works directly with a GridView. I set up an SqlDataSource
and a GridView to view and update the Northwind Customer Table without any
problem, but the Update SQL code in the SqlDataSource did not include a
CustomerID = @CustomerID, because CustomerID is the primary key of the
Customer table. So try changing your Update code to

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 = @Original_CustomerID)

You may have to change the WHERE clause to

WHERE (CustomerID = @CustomerID)

If that does not fix the problem, I suggest using an SqlDataSource instead
of the ObjectDataSource.

HTH

Ron.
Jul 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1796
by: chonkme | last post by:
Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name....
0
940
by: yossimotro | last post by:
Hi, I'm using a gridview in my project and its footer to add new records. The gridview is connected to an AccessDataSource which contains select, insert and delete commands. The problem...
0
1550
by: Frank | last post by:
Hello All, I am working with VS.NET 2005 and I have an editable GridView whose HTML markup is shown below. In short, when the user clicks on the Edit button, one of the textboxes is replaced...
0
1352
by: Frank | last post by:
Hello All, I am working with VS.NET 2005 and I have an editable GridView whose HTML markup is shown below. In short, when the user clicks on the Edit button, one of the textboxes is replaced...
0
2367
by: den 2005 | last post by:
Hi everybody, I created a Gridview with a TemplateField and there is Label control in ItemTemplate and a DropdownList control in EditItemTemplate, I was to displayed them ok when I click the...
2
2617
by: Richard Carpenter | last post by:
I have a four-page tabcontrol with a gridview on each page. I have the primary key column of each gridview set to hidden (visible = false), but it still shows up on all but the first page. Anyone...
0
1031
by: singh79 | last post by:
Hi.. In My DropDown some Procedure Bind,My Drop Down name is Ddlpro ,(Bind By Table "PatProcedure") ,same Table PatProcedure again use and bind GridView ,In Gridviw I Can Take Template...
2
2449
by: William LaMartin | last post by:
On webform, I am populating a GridView from a SQLDatasource based on a MySQL table named PIB. There is no vb code involved. Everything is done in the source for the aspx page, provided below. ...
1
1827
nitindel
by: nitindel | last post by:
Hi All, Please tell me any good site for Gridview control.(not for datagrid). I am facing error in fetching the values of the Bound columns in the gridview: lease tell me how should i...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.