export data to an xml from database and import it to database.

  • Hello

    I want to export data from database to an xml file.I am using the following code to export....

    string query = "SELECT ItemTable.DCSName, ItemTable.Attribute, ItemTable.Size, ItemTable.InventoryCost, OrderTable.OrderID, OrderTable.OrderNumber,OrderTable.OrderDate FROM ItemTable INNER JOIN OrderTable ON ItemTable.ItemNumber = OrderTable.ItemNumber FOR XML auto";

    SqlDataAdapter da = new SqlDataAdapter(query, con);

    DataSet ds = new DataSet("Department");

    da.Fill(ds,"ItemTable");

    ds.WriteXml("C:\\Users\\thomas\\Desktop\\Sabid\\XMLTESTDS.xml", XmlWriteMode.IgnoreSchema);

    i used a join query.

    i got the xml file with content is

    i want it in this format

    <ItemTable DCSName="Women Casual Shoe"

    Attribute="Brow"

    Size="6"

    InventoryCost="1005">

    <OrderTable OrderID="1001"

    OrderNumber="100"

    OrderDate="2008-10-04T00:00:00"

    or i want to import the data from first xml to database(import the values into proper tables...)

    please give me the solution to this

    Thanks and regards,

    Sabid

  • We cannot see your XML. Try attaching it as a .txt file.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Please give me a full sample application using sqlxml to i export data from database to xml and import data to database from xml

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply