I don't know where you stored your table. But one thing you should do that, create webservice method that return a
Dataset
. After you create the webservice, then consume it you application. The point that you need to have an XML output. To get this XML call the
DataSet.WriteXML(string fileName)
method.
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService : System.Web.Services.WebService
{
public WebService()
{
}
[WebMethod]
public DataSet GetData()
{
DataSet dataSet = new DataSet();
using (SqlConnection connection = new SqlConnection("connectionString"))
{
connection.Open();
using (SqlCommand command = new SqlCommand("SQL Statement",connection))
{
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dataSet);
}
}
return dataSet;
}
}
Web service consumer application say Asp.Net
protected void Page_Load(object sender, EventArgs e)
{
WebService ws = new WebService();
DataSet dataSet= ws.GetData();
dataSet.WriteXml("c:\\exportToXML.xml");
}
I hope this will help you.