C # Pass dataTable to web service SOAP

0

I have a question about sending information to a Web Service. From code I have a DataTable that is filled with a query to Database, which I want to send to the Web Service in xml format.

How to send a DataTable to a webservice in XML format?

DataTable Code:

public void consultaUSistema(DataGridView datagridView)
{
    string sXMLparam = "";
    DataSet dtsCatalogo = new DataSet();

    sXMLparam = "<root><accion>C</accion>";
    sXMLparam += "</root>";

    ReaderAndWriter.ConnectionString = Constants.connectionString1;
    try
    {
        dtsCatalogo = ReaderAndWriter.OneParameterStoreProcCaller("SP", sXMLparam);
        datagridView.DataSource = dtsCatalogo.Tables[0];

        if (dtsCatalogo.Tables[0] != null)
        {
            DataTable dt = new DataTable();
            dt = dtsCatalogo.Tables[0]; //aquí se llena el dataTable


        }
    }
    catch (Exception objException)
    {
    }
}
    
asked by Pamme Cobos 10.05.2017 в 19:01
source

1 answer

0

You can directly convert your DataSet to xml

string XML= dtsCatalogo.GetXml();
    
answered by 12.05.2017 / 22:35
source