Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

When I return a DataView I get the following error

Status
Not open for further replies.

KevoMee

Technical User
Apr 30, 2002
72
IE
"You must implement the Add(System.Data.DataRowView) method on System.Data.DataView because it inherits from ICollection"

Does anyone know exactly what this means? Here is a snipet of my code:

[WebMethod]
public DataView getdataview()
{
sqlDataAdapter1.Fill(authorDataSet1);
DataView dv = authorDataSet1.Tables["authors"].DefaultView;
return dv;
}

It only happens when I return a DataView. So if I was to make it a return void function and do datachanges to the dataview inside this function there would be no problems.

If anyone can help it would be much appreciated.
 
crankyjim is right - you can't return a DataView because it can't be serialized across a webmethod call (it maintains a connection to the database). You can use a dataset, or roll your own XML.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top