Ejemplo n.º 1
0
        private List <Object> _ListPOIS()
        {
            var driver = new XlsDriver();
            var conn   = driver.Connect(@"C:\Users\Entrevista\Documents\Visual Studio 2015\Projects\MapsTest\MapsTest\bin\Data\ds.xls");

            conn.Open();
            var dt = driver.ListData(conn, "POIs");


            var data = new List <Object>();

            foreach (DataRow row in dt.Rows)
            {
                IDictionary <string, object> props = new Dictionary <string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    props.Add(col.ColumnName.Replace(" ", "").Replace("(", "").Replace(")", ""), row[col.Ordinal]);
                }

                data.Add(props);
                return(data);
            }
            conn.Close();
            return(data);
        }
Ejemplo n.º 2
0
        public void RunWithoutOpen()
        {
            var driver = new XlsDriver();

            Assert.IsNotNull(driver);
            var connection = driver.Connect(XlsUri);

            driver.ListTables(connection);
        }
Ejemplo n.º 3
0
        public void ListTables()
        {
            var driver = new XlsDriver();

            using (var connection = driver.Connect(XlsUri)){
                connection.Open();
                var dt = driver.ListTables(connection);
                Assert.AreEqual(dt.Length, 3);
                connection.Close();
            }
        }
Ejemplo n.º 4
0
        public void Connect()
        {
            var driver = new XlsDriver();

            Assert.IsNotNull(driver);
            var connection = driver.Connect(XlsUri);

            connection.Open();
            Assert.AreEqual(connection.State, System.Data.ConnectionState.Open);
            connection.Close();
            Assert.AreEqual(connection.State, System.Data.ConnectionState.Closed);
        }
Ejemplo n.º 5
0
        public void ListData()
        {
            var driver = new XlsDriver();

            using (var connection = driver.Connect(XlsUri))
            {
                connection.Open();
                var dt = driver.ListData(connection, "POIs");
                Assert.IsNotNull(dt);
                Assert.IsTrue(dt.Rows.Count > 0);
                connection.Close();
            }
        }
Ejemplo n.º 6
0
        public void Select()
        {
            var driver = new XlsDriver();

            using (var connection = driver.Connect(XlsUri))
            {
                connection.Open();
                var dt = driver.Select(connection, "SELECT * FROM [Categories$]");
                Assert.IsNotNull(dt);
                Assert.IsTrue(dt.Rows.Count > 0);
                connection.Close();
            }
        }
Ejemplo n.º 7
0
        public void InsertData()
        {
            var driver = new XlsDriver();

            using (var connection = driver.Connect(XlsUri))
            {
                connection.Open();
                driver.InsertData(connection, "Categories", new List <string> {
                    "Id", "Value"
                }, new List <string> {
                    "T", "Test"
                });

                connection.Close();
            }
        }