473,569 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP: must implement the Add(System.Data .DataRowView) Method?

I have a C# Web Service that some of the methods (ones that return integers)
work and some do not (the ones that return a DataView.

Here is some code in the WebService that is giving me the problem. The
oAllData function gets run on the initialization of the class.
DataSet oAllData = new DataSet();
[WebMethod(Descr iption="Return a DataView of the Active Notifications")]
public object GetActiveNotifi cations() {
DataView oNeededData = new DataView(oAllDa ta.Tables["Notificati on"]);
oNeededData.Row Filter = "Status = 'Active'";

return oNeededData;
}
private DataSet ConnectToDataSt ore() {
DataSet oDS = new DataSet();
oDS.ReadXml(Ser ver.MapPath("NA AData.xml"));
return oDS;
}
Here is the code that runs when I click a button. It is supposed to pass
back a DataView and then I would bind that to a DataGrid.

private void cmndGetNotifica tions_Click(obj ect sender, System.EventArg s
e) {
TestNANAA.NAWS. NANAA oWS = new TestNANAA.NAWS. NANAA();
DataView oDV = new DataView();
oDV = (DataView)oWS.G etActiveNotific ations();
dgrdData.DataSo urce = oDV ;
dgrdData.DataBi nd();
}
However, when I click the button to do it I get the following error:
Server was unable to process request. --> There was an error generating the
XML document. --> You must implement the Add(System.Data .DataRowView) method
on System.Data.Dat aView because it inherits from ICollection

Line 92:
RequestNamespac e="http://www.NAMfg.com/NAMfgWebService s/NotificationsAn dAlerts/",
ResponseNamespa ce="http://www.NAMfg.com/NAMfgWebService s/NotificationsAn dAlerts/",
Use=System.Web. Services.Descri ption.SoapBindi ngUse.Literal,
ParameterStyle= System.Web.Serv ices.Protocols. SoapParameterSt yle.Wrapped)]
Line 93: public object GetActiveNotifi cations() {
Line 94: object[] results =
this.Invoke("Ge tActiveNotifica tions", new object[0]);
Line 95: return ((object)(resul ts[0]));
Line 96: }
I need some help here. Pulling my hair out trying to figure out what to do.

TIA,
Kevin
--
Thanx,
Grigs
Nov 21 '05 #1
2 4599

"Grigs" <Gr***@discussi ons.microsoft.c om> wrote in message
news:1E******** *************** ***********@mic rosoft.com...
I have a C# Web Service that some of the methods (ones that return integers) work and some do not (the ones that return a DataView.

Here is some code in the WebService that is giving me the problem. The
oAllData function gets run on the initialization of the class.
DataSet oAllData = new DataSet();
[WebMethod(Descr iption="Return a DataView of the Active Notifications")] public object GetActiveNotifi cations() {
DataView oNeededData = new DataView(oAllDa ta.Tables["Notificati on"]); oNeededData.Row Filter = "Status = 'Active'";

return oNeededData;
}
private DataSet ConnectToDataSt ore() {
DataSet oDS = new DataSet();
oDS.ReadXml(Ser ver.MapPath("NA AData.xml"));
return oDS;
}
Here is the code that runs when I click a button. It is supposed to pass
back a DataView and then I would bind that to a DataGrid.

private void cmndGetNotifica tions_Click(obj ect sender, System.EventArg s e) {
TestNANAA.NAWS. NANAA oWS = new TestNANAA.NAWS. NANAA();
DataView oDV = new DataView();
oDV = (DataView)oWS.G etActiveNotific ations();
dgrdData.DataSo urce = oDV ;
dgrdData.DataBi nd();
}
However, when I click the button to do it I get the following error:
Server was unable to process request. --> There was an error generating the XML document. --> You must implement the Add(System.Data .DataRowView) method on System.Data.Dat aView because it inherits from ICollection

Line 92:
RequestNamespac e="http://www.NAMfg.com/NAMfgWebService s/NotificationsAn dAler
ts/", ResponseNamespa ce="http://www.NAMfg.com/NAMfgWebService s/NotificationsAn dAle
rts/", Use=System.Web. Services.Descri ption.SoapBindi ngUse.Literal,
ParameterStyle= System.Web.Serv ices.Protocols. SoapParameterSt yle.Wrapped)]
Line 93: public object GetActiveNotifi cations() {
Line 94: object[] results =
this.Invoke("Ge tActiveNotifica tions", new object[0]);
Line 95: return ((object)(resul ts[0]));
Line 96: }
I need some help here. Pulling my hair out trying to figure out what to do.


Hi Kevin,

The short story is that you cannot return a DataView from a WebMethod
because a DataView is not XML serializable (for more information, read
http://support.microsoft.com/default...b;en-us;306134 and
http://msdn.microsoft.com/library/de...bservices.asp).

Instead of a DataView, you will need to return something that can be
serialized to XML, e.g., a DataSet or an array of custom objects.

Regards,
Sami
Nov 21 '05 #2
Understood. Well, I am dealing with it at least.
Thank you, what I have done to get around the issue was when I returned a
DataSet that always worked. However, my initial DataSet has 5 tables in it.
I have adjusted the WS to now create an empty DataSet and add new DataTable
and I fill in the values and return that.

Works like a champ, thanks again,
Kevin
Nov 21 '05 #3

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

Similar topics

1
1337
by: authorking | last post by:
How could I add data rows into a datagrid controll so that I can edit my data in the data rows.
1
3735
by: Marsha | last post by:
Does anyone know how to add a new data provider to Visual Studio - to the Provider list in Server Explorer. I am using Sybase's ADO.NET Data Provider. It has been added to my GAC and appears in my References. However, I would like to add the provider to the Provider list in Server Explorer. Thanks. ~Marsha
5
3370
by: Steve Teeples | last post by:
Can someone point me to a document that clearly identifies the steps of creating a good help system for an application? I have a test tool that I'd like to add help to so that others will know how to use it. -- Steve
6
5404
by: John Cobb | last post by:
MSDN and intellisense shows the Add method of Hashtable being overridable however when I use this code: Public Class RAL Inherits Hashtable Public Overrides Sub Add(ByVal Key As String, ByVal Value As Object) End Sub
0
1713
by: John Grandy | last post by:
My business-layer class has a method that returns a System.Collections.Specialized.NameValueCollection I wrapped this business-layer class in a Web Service. In an ASP.NET project, when I attempt to add a Web Reference to this Web Service, I receive the error : You must implement the Add(System.String) method on...
9
2236
by: JJ | last post by:
Do you all use HTML help workshop to create your help system. I am finding it quite clumsy to use. Mayeb because I am not used to using it. Do any of you use any other techniques to create help for your progs? Whats the current popular approach to creating help? I am only wanting a straight help file accessible from a menu - no context...
8
1687
by: redefined.horizons | last post by:
I did some searching for this topic, but couldn't find anything. A search of this list only turned up an old post from 2002. I'd like to add a comprehesive help system to my Python Application. By "comprehensive" I mean regular "read-like-a-book" help and context sensitive help that can be launched from the application. Is there an...
4
7995
by: Mo | last post by:
Hi, I am writing a console application to send a key sequence to an old clunky application on a regular interval using the windows scheduler. I can get it to work if it is a windows form application but not in a console application. Two questions I have: 1) how can I get this code modified to use System.Windows.Forms.Keys 2) I like to...
0
7323
acoder
by: acoder | last post by:
Problem The select object's add method doesn't append options to the end of the list. Browser Internet Explorer Example The Javascript code for appending an option element at the end of a select dropdown list: var opt = document.createElement("option"); opt.name = "optName";
0
7703
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
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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
7679
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
7983
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...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
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.