cannot convert system.data.datagridview to object[]

126 views Asked by At

i am trying to save update ,delete, and insert on datagridview using services of a wcf

private void SaveAll_Click(object sender, EventArgs e)
{
    ServiceReferenceExemplaires.ServiceExemplairesClient se=new ServiceReferenceExemplaires.ServiceExemplairesClient();
    DataView oView = (DataView)gridData.DataSource;
    se.saveAll(oView);
}

the error is coming from se.saveAll(oView) at the parameter i think the problem is with wcf ,because without exposing the services it's fine

ServiceExemplaires se = new ServiceExemplaires();
DataView oView = (DataView)gridData.DataSource;
se.saveAll(oView);

but the idea was to use wcf to access the service from another machine

2

There are 2 answers

2
Merlijn On

Can you be more specific? Does the saveAll function not accept the DataView?

If that is the case, try putting it like:

se.saveAll(new object[] {oView} );
0
Sharp On

it seems dataviews are not seriazable , instead of trying to save any update ,delete or create within a datagridView and give all the dataview as a parameter to the wcf i just used another form which tooks all the paramaters with simple textBox and eventually pass one by one the value as a parameters to the wcf service