Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to read XML file(just like file browser in asp.net) and store the value in the temp table(LINQ is an optional). Since I am new to desktop application codes are highly appreciable.
Thank you in ADvance.
Posted
Updated 9-Sep-12 19:52pm
v2
Comments
Kuthuparakkal 10-Sep-12 2:06am    
what do you mean by temp table ? SQL ? Oracle ? MySQL ?
Purushottam Prajapati 10-Sep-12 2:09am    
SQL (temporary table : just to hold data for use)

Hi Purushottam hope this wil help full,

C#
//creating a data table to store      
  DataTable dt = new DataTable();
      

//give the path of the xml file or name if it is in current directory
        dt.ReadXml("Read.xml");

//dt is the table holding values set from the xml now we can write it to 
//the sql database


string strConnectionString = @"Data Source=xyzYY\SQLEXPRESS;Initial Catalog=TrackerDB;User ID=admin;Password=wxyz;"; 
               SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnectionString);sqlBulk.DestinationTableName = "dbo.Quote_Staging"; sqlBulk.WriteToServer(dt);
               sqlBulk.Close();
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900