static void setData() { DataIntegrator.Helpers.RDBMS.RDBMSHelper helper = new DataIntegrator.Helpers.RDBMS.RDBMSHelper(); string providerName = "System.Data.SqlClient"; string connStr = @"Data Source=.\SQLExpress;Initial Catalog=FactoryFloorKeyStore;Integrated Security=True"; string commandText = "select [ProductKeyID],[ProductKey],[ProductKeyStateID],[OEMPartNumber],[ProductKeyState],[ActionCode],[CreatedBy],[CreatedDate],[ModifiedBy],[ModifiedDate] from [dbo].[ProductKeyInfo]";// FOR XML EXPLICIT"; commandText = "select * from dbo.ProductKeyInfo"; //commandText = "select [ProductKeyID],[ProductKey],[ProductKeyStateID],[OEMPartNumber],[ProductKeyState] from dbo.ProductKeyInfo"; //System.Xml.XmlDocument document = helper.Query(providerName, connStr, commandText, "text", OperationMethod.Retrieve, false) as System.Xml.XmlDocument; //System.Xml.XmlDocument document = new System.Xml.XmlDocument(); //document.Load(reader); string xml = helper.Query(providerName, connStr, commandText, "text", OperationMethod.Retrieve).ToString(); //document.InnerXml; //Console.WriteLine(xml); FileStream fileStream = new FileStream(@"D:\backup\RDBMSXmlTest2.xml", FileMode.Create, FileAccess.Write, FileShare.Write); StreamWriter writer = new StreamWriter(fileStream, Encoding.UTF8); //xml = xml.Insert(xml.IndexOf("?>"), " encoding=\"utf-8\""); //xml = xml.Substring(0, xml.LastIndexOf(">") + 1); writer.Write(xml); writer.Flush(); fileStream.Flush(); writer.Close(); fileStream.Close(); connStr = @"Data Source=.\SQLExpress;Initial Catalog=FactoryFloorKeyStore_2;Integrated Security=True"; string typeName = "Oracle.DataAccess.Client.OracleBulkCopy"; string assemblyName = "System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; typeName = "System.Data.SqlClient.SqlBulkCopy"; //assemblyName = "Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342"; helper.BulkCopy(xml, "System.Data.SQLClient", connStr, "ProductKeyInfo", assemblyName, typeName); Console.Read(); }
static void getData() { DataIntegrator.Helpers.RDBMS.RDBMSHelper helper = new DataIntegrator.Helpers.RDBMS.RDBMSHelper(); string providerName = "System.Data.SqlClient"; string connStr = @"Data Source=.\SQLExpress;Initial Catalog=FactoryFloorKeyStore;Integrated Security=True"; string commandText = "select [ProductKeyID],[ProductKey],[ProductKeyStateID],[OEMPartNumber],[ProductKeyState],[ActionCode],[CreatedBy],[CreatedDate],[ModifiedBy],[ModifiedDate] from [dbo].[ProductKeyInfo]";// FOR XML EXPLICIT"; //System.Xml.XmlDocument document = helper.Query(providerName, connStr, commandText, "text", OperationMethod.Retrieve, false) as System.Xml.XmlDocument; //System.Xml.XmlDocument document = new System.Xml.XmlDocument(); //document.Load(reader); string xml = helper.Query(providerName, connStr, commandText, "text", OperationMethod.Retrieve).ToString(); //document.InnerXml; Console.WriteLine(xml); FileStream fileStream = new FileStream(@"D:\backup\RDBMSXmlTest.xml", FileMode.Create, FileAccess.Write, FileShare.Write); StreamWriter writer = new StreamWriter(fileStream, Encoding.UTF8); //xml = xml.Insert(xml.IndexOf("?>"), " encoding=\"utf-8\""); //xml = xml.Substring(0, xml.LastIndexOf(">") + 1); writer.Write(xml); writer.Flush(); fileStream.Flush(); writer.Close(); fileStream.Close(); Console.Read(); }