winforms - how to import .xml file to database -
Hello I want to import my .xml file into a SQL Server database for windows application in asp.net 3.5 c # .
this can help you
this code snippet can be helpful
Dataset Report Data = New Dataset (); ReportData.ReadXml (Server.MapPath ("report.xml")); SqlConnection connection = new SqlConnection ("Connection STRING"); SqlBulkCopy SBC = new SqlBulkCopy (connection); Sbc.DestinationTableName = "report_table"; // If your DB name does not match the name of your XML element 100% // then destination DB calls related to Source XML Elements (the first Ultimate) with sbc.ColumnMappings.Add ("Campaign", "Campaign_ID") ; Sbc.ColumnMappings.Add ("cost", "cost_USD"); Connection.Open ();
View
Comments
Post a Comment