return object from WebMethod

  • Thread starter Thread starter kids_pro
  • Start date Start date
K

kids_pro

Hi there,

I try to create a webmethod in webservice by return DataView but each time I
compile there is and error
[WebMethod]
public DataView GetAuthor(){
.....
return ds.Tables["Authors"].DefaultView;
}

You must implement the Add(System.Data.DataRowView) method on
System.Data.DataView because it inherits from ICollection.

Please kindly advice.

Regards
 
Essentially whats happening is that VS.net creates a proxy class called
Reference.cs. Out there it defines the DataView property which is
obviously not implemented correctly as its only a placeholder value
object. Try changing the DataView return type to object and you should
be good to go
Thanks

kids_pro said:
Hi there,

I try to create a webmethod in webservice by return DataView but each time I
compile there is and error
[WebMethod]
public DataView GetAuthor(){
.....
return ds.Tables["Authors"].DefaultView;
}

You must implement the Add(System.Data.DataRowView) method on
System.Data.DataView because it inherits from ICollection.

Please kindly advice.

Regards
 
many thanks
Dilip Krishnan said:
Essentially whats happening is that VS.net creates a proxy class called
Reference.cs. Out there it defines the DataView property which is
obviously not implemented correctly as its only a placeholder value
object. Try changing the DataView return type to object and you should
be good to go
Thanks

kids_pro said:
Hi there,

I try to create a webmethod in webservice by return DataView but each time I
compile there is and error
[WebMethod]
public DataView GetAuthor(){
.....
return ds.Tables["Authors"].DefaultView;
}

You must implement the Add(System.Data.DataRowView) method on
System.Data.DataView because it inherits from ICollection.

Please kindly advice.

Regards

--
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilipdotnet at apdiya dot com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top