Consume Web API in ASPX Page using C# in ASP.Net

Last Reply one year ago By dharmendr

Posted one year ago

hello,

this code for select data from sql covert to xml and download works great.

now i am looking for the same way for insert and update methods so user can xml file in their directory and run insert and update using xml and xml file send the insert and update to database sql server please advice

protected void GenerateXML(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ConnectionString);
    SqlDataAdapter dt = new SqlDataAdapter("SELECT * FROM Customers", con);
    DataSet ds = new DataSet();
    dt.Fill(ds, "Customers");
    ds.WriteXml(Server.MapPath("~/Customers.xml"));
}
 
protected void DownloadXML(object sender, EventArgs e)
{
    if (System.IO.File.Exists(Server.MapPath("~/Customers.xml")))
    {
        DownloadFile(Server.MapPath("~/Customers.xml"));
    }
}

I want an API which can take value of texbox and save in to sql server database.

You are viewing reply posted by: dharmendr one year ago.