Skip to main content
removeu 370 caracteres do conteúdo
Fonte Link
user28595
user28595
        var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
        var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

        var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

        var sql = "SELECT * FROM [PARAC1$]";

        var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
        var dt = new System.Data.DataTable();

        conexao.Open();

        System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
        dt.Load(dr);

        conexao.Close();
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);

            XmlNode ejournal = doc.CreateElement("EJournal");
            doc.AppendChild(ejournal);

            XmlNode dealer = doc.CreateElement("Dealer");
            XmlAttribute valueID = doc.CreateAttribute("ID");
            valueID.Value = dealerID;
            dealer.Attributes.Append(valueID);
            ejournal.AppendChild(dealer);

            XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
            PeriodBegin.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodBegin);

            XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
            PeriodEnd.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodEnd);

            XmlNode Transaction = doc.CreateElement("Transaction");
            dealer.AppendChild(Transaction);

            //inicio da transaction\\

            XmlNode CardNumber = doc.CreateElement("CardNumber");
            CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
            Transaction.AppendChild(CardNumber);
 
            doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");
        var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
        var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

        var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

        var sql = "SELECT * FROM [PARAC1$]";

        var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
        var dt = new System.Data.DataTable();

        conexao.Open();

        System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
        dt.Load(dr);

        conexao.Close();
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);

            XmlNode ejournal = doc.CreateElement("EJournal");
            doc.AppendChild(ejournal);

            XmlNode dealer = doc.CreateElement("Dealer");
            XmlAttribute valueID = doc.CreateAttribute("ID");
            valueID.Value = dealerID;
            dealer.Attributes.Append(valueID);
            ejournal.AppendChild(dealer);

            XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
            PeriodBegin.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodBegin);

            XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
            PeriodEnd.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodEnd);

            XmlNode Transaction = doc.CreateElement("Transaction");
            dealer.AppendChild(Transaction);

            //inicio da transaction\\

            XmlNode CardNumber = doc.CreateElement("CardNumber");
            CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
            Transaction.AppendChild(CardNumber);
 
            doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");
var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

var sql = "SELECT * FROM [PARAC1$]";

var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
var dt = new System.Data.DataTable();

conexao.Open();

System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
dt.Load(dr);

conexao.Close();
XmlDocument doc = new XmlDocument();
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(docNode);

XmlNode ejournal = doc.CreateElement("EJournal");
doc.AppendChild(ejournal);

XmlNode dealer = doc.CreateElement("Dealer");
XmlAttribute valueID = doc.CreateAttribute("ID");
valueID.Value = dealerID;
dealer.Attributes.Append(valueID);
ejournal.AppendChild(dealer);

XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
PeriodBegin.AppendChild(doc.CreateTextNode(data));
dealer.AppendChild(PeriodBegin);

XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
PeriodEnd.AppendChild(doc.CreateTextNode(data));
dealer.AppendChild(PeriodEnd);

XmlNode Transaction = doc.CreateElement("Transaction");
dealer.AppendChild(Transaction);

//inicio da transaction\\

XmlNode CardNumber = doc.CreateElement("CardNumber");
CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
Transaction.AppendChild(CardNumber);
doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");
Reversão para edição 1
Fonte Link
user28595
user28595

var fileName = @"C:\Users\HP8200\Desktop\test.xlsx"; var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties="Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text""; ;

        var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
        var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

        var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

        var sql = "SELECT * FROM [PARAC1$]";

        var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
        var dt = new System.Data.DataTable();

        conexao.Open();

        System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
        dt.Load(dr);

        conexao.Close();
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);

            XmlNode ejournal = doc.CreateElement("EJournal");
            doc.AppendChild(ejournal);

            XmlNode dealer = doc.CreateElement("Dealer");
            XmlAttribute valueID = doc.CreateAttribute("ID");
            valueID.Value = dealerID;
            dealer.Attributes.Append(valueID);
            ejournal.AppendChild(dealer);

            XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
            PeriodBegin.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodBegin);

            XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
            PeriodEnd.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodEnd);

            XmlNode Transaction = doc.CreateElement("Transaction");
            dealer.AppendChild(Transaction);

            //inicio da transaction\\

            XmlNode CardNumber = doc.CreateElement("CardNumber");
            CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
            Transaction.AppendChild(CardNumber);

            doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");

var fileName = @"C:\Users\HP8200\Desktop\test.xlsx"; var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties="Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text""; ;

var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

var sql = "SELECT * FROM [PARAC1$]";

var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
var dt = new System.Data.DataTable();

conexao.Open();

System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
dt.Load(dr);

conexao.Close();
XmlDocument doc = new XmlDocument();
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(docNode);

XmlNode ejournal = doc.CreateElement("EJournal");
doc.AppendChild(ejournal);

XmlNode dealer = doc.CreateElement("Dealer");
XmlAttribute valueID = doc.CreateAttribute("ID");
valueID.Value = dealerID;
dealer.Attributes.Append(valueID);
ejournal.AppendChild(dealer);

XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
PeriodBegin.AppendChild(doc.CreateTextNode(data));
dealer.AppendChild(PeriodBegin);

XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
PeriodEnd.AppendChild(doc.CreateTextNode(data));
dealer.AppendChild(PeriodEnd);

XmlNode Transaction = doc.CreateElement("Transaction");
dealer.AppendChild(Transaction);

//inicio da transaction\\

XmlNode CardNumber = doc.CreateElement("CardNumber");
CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
Transaction.AppendChild(CardNumber);

doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");
        var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
        var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

        var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

        var sql = "SELECT * FROM [PARAC1$]";

        var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
        var dt = new System.Data.DataTable();

        conexao.Open();

        System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
        dt.Load(dr);

        conexao.Close();
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);

            XmlNode ejournal = doc.CreateElement("EJournal");
            doc.AppendChild(ejournal);

            XmlNode dealer = doc.CreateElement("Dealer");
            XmlAttribute valueID = doc.CreateAttribute("ID");
            valueID.Value = dealerID;
            dealer.Attributes.Append(valueID);
            ejournal.AppendChild(dealer);

            XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
            PeriodBegin.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodBegin);

            XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
            PeriodEnd.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodEnd);

            XmlNode Transaction = doc.CreateElement("Transaction");
            dealer.AppendChild(Transaction);

            //inicio da transaction\\

            XmlNode CardNumber = doc.CreateElement("CardNumber");
            CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
            Transaction.AppendChild(CardNumber);

            doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");

var fileName = @"C:\Users\HP8200\Desktop\test.xlsx"; var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties="Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text""; ;

        var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
        var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

        var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

        var sql = "SELECT * FROM [PARAC1$]";

        var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
        var dt = new System.Data.DataTable();

        conexao.Open();

        System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
        dt.Load(dr);

        conexao.Close();
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);

            XmlNode ejournal = doc.CreateElement("EJournal");
            doc.AppendChild(ejournal);

            XmlNode dealer = doc.CreateElement("Dealer");
            XmlAttribute valueID = doc.CreateAttribute("ID");
            valueID.Value = dealerID;
            dealer.Attributes.Append(valueID);
            ejournal.AppendChild(dealer);

            XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
            PeriodBegin.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodBegin);

            XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
            PeriodEnd.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodEnd);

            XmlNode Transaction = doc.CreateElement("Transaction");
            dealer.AppendChild(Transaction);

            //inicio da transaction\\

            XmlNode CardNumber = doc.CreateElement("CardNumber");
            CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
            Transaction.AppendChild(CardNumber);

            doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");
        var fileName = @"C:\Users\HP8200\Desktop\test.xlsx";
        var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text\""; ;

        var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

        var sql = "SELECT * FROM [PARAC1$]";

        var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
        var dt = new System.Data.DataTable();

        conexao.Open();

        System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
        dt.Load(dr);

        conexao.Close();
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);

            XmlNode ejournal = doc.CreateElement("EJournal");
            doc.AppendChild(ejournal);

            XmlNode dealer = doc.CreateElement("Dealer");
            XmlAttribute valueID = doc.CreateAttribute("ID");
            valueID.Value = dealerID;
            dealer.Attributes.Append(valueID);
            ejournal.AppendChild(dealer);

            XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
            PeriodBegin.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodBegin);

            XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
            PeriodEnd.AppendChild(doc.CreateTextNode(data));
            dealer.AppendChild(PeriodEnd);

            XmlNode Transaction = doc.CreateElement("Transaction");
            dealer.AppendChild(Transaction);

            //inicio da transaction\\

            XmlNode CardNumber = doc.CreateElement("CardNumber");
            CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
            Transaction.AppendChild(CardNumber);

            doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");

var fileName = @"C:\Users\HP8200\Desktop\test.xlsx"; var connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Extended Properties="Excel 12.0;IMEX=1;HDR=NO;TypeGuessRows=0;ImportMixedTypes=Text""; ;

var conexao = new System.Data.OleDb.OleDbConnection(connectionString);

var sql = "SELECT * FROM [PARAC1$]";

var cmm = new System.Data.OleDb.OleDbCommand(sql, conexao);
var dt = new System.Data.DataTable();

conexao.Open();

System.Data.OleDb.OleDbDataReader dr = cmm.ExecuteReader();
dt.Load(dr);

conexao.Close();
XmlDocument doc = new XmlDocument();
XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(docNode);

XmlNode ejournal = doc.CreateElement("EJournal");
doc.AppendChild(ejournal);

XmlNode dealer = doc.CreateElement("Dealer");
XmlAttribute valueID = doc.CreateAttribute("ID");
valueID.Value = dealerID;
dealer.Attributes.Append(valueID);
ejournal.AppendChild(dealer);

XmlNode PeriodBegin = doc.CreateElement("PeriodBegin");
PeriodBegin.AppendChild(doc.CreateTextNode(data));
dealer.AppendChild(PeriodBegin);

XmlNode PeriodEnd = doc.CreateElement("PeriodEnd");
PeriodEnd.AppendChild(doc.CreateTextNode(data));
dealer.AppendChild(PeriodEnd);

XmlNode Transaction = doc.CreateElement("Transaction");
dealer.AppendChild(Transaction);

//inicio da transaction\\

XmlNode CardNumber = doc.CreateElement("CardNumber");
CardNumber.AppendChild(doc.CreateTextNode("7710007007379"));
Transaction.AppendChild(CardNumber);

doc.Save(@"C:\Users\HP8200\Desktop\pedro1123.xml");
Fonte Link
Pedro Azevedo
  • 463
  • 2
  • 6
  • 18
Carregando