473,585 Members | 2,496 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 - ObjectDataSourc e - 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 ObjectDataSourc e and connect my DataView to the ObjectDataSourc e. (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

ObjectDataSourc e 'ods2' could not find a non-generic method 'Update' that
has parameters: CompanyName, ContactName, ContactTitle, Address, City,
Region, PostalCode, Country, Phone, Fax, original_Custom erID.
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_Custo merID)
Jul 25 '06 #1
3 2153
Ron
"Tina" <Ti**********@n ospamexcite.com wrote in message
news:ek******** ********@TK2MSF TNGP03.phx.gbl. ..
I'm trying to do something very straightforward in a 2.0 asp.net app with
a GridView - ObjectDataSourc e - 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 ObjectDataSourc e and connect my DataView to the
ObjectDataSourc e. (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

ObjectDataSourc e 'ods2' could not find a non-generic method 'Update' that
has parameters: CompanyName, ContactName, ContactTitle, Address, City,
Region, PostalCode, Country, Phone, Fax, original_Custom erID.
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_Custo merID)
Hi Tina.
The problem could be caused by an incorrect setting in your
ObjectDataSourc e.Have you made sure the ObjectDataSourc e is configured not
to send original values together with your own parameters?
The ObjectDataSourc e OldValuesParame terFormatString property should not be
set if you want to send only your own parameters.
HTH
Ron.
Jul 25 '06 #2
OldValuesParame terFormatString 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******** ******@TK2MSFTN GP02.phx.gbl...
"Tina" <Ti**********@n ospamexcite.com wrote in message
news:ek******** ********@TK2MSF TNGP03.phx.gbl. ..
>I'm trying to do something very straightforward in a 2.0 asp.net app with
a GridView - ObjectDataSourc e - 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 ObjectDataSourc e and connect my DataView to the
ObjectDataSour ce. (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

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

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

Jul 25 '06 #3
Ron

"Tina" <Ti**********@n ospamexcite.com wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
OldValuesParame terFormatString 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 ObjectDataSourc e 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_Custo merID)

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 ObjectDataSourc e.

HTH

Ron.
Jul 26 '06 #4

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

Similar topics

6
1808
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. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag...
0
945
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 occurs when the AccessDataSource is empty, the gridview won't show at all, not even the footer so I can't add new data. I know I can give up on the...
0
1559
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 with a DropDownList that displays account numbers in a list. If the user selects an account from the DropDownList that already exists in the list, I...
0
1357
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 with a DropDownList that displays account numbers in a list. If the user selects an account from the DropDownList that already exists in the list, I...
0
2374
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 Edit Command button. But when I about to get the value of this template field I get an empty string value. I check the following the local dtFiles has...
2
2622
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 else see this behavior? How might I correct it?
0
1036
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 Column,And One CheckBox in template Column "ChkPro" , In GridView if any Procedure is check then This Check Box related Values Is find...., But My Problem...
2
2452
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. The update works fine, but a delete of a row produces the following error: Exception Details: System.Data.Odbc.OdbcException: ERROR ...
1
1842
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 fetch the value..of a bound column..?? Below is the code.:
0
7908
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7950
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6606
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3835
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.