Ejemplo n.º 1
0
        static void TestDataReader(string connstr, string driver)
        {
            DbEngineAdapter db =
                new DbEngineAdapter(connstr, driver);
            string query = "select * from logs";

            if (db.Open())
            {
                IDataReader reader = db.ExecuteQuery(query);
                while (reader.Read())
                {
                    Console.WriteLine(reader.GetString(0));
                }
            }
            db.Close();
        }
Ejemplo n.º 2
0
        static void TestInsert(string connstr, string driver)
        {
            DbEngineAdapter db =
                new DbEngineAdapter(connstr,
                                    driver);
            //----- a Test Log Entry
            string test = "Log value is " + Math.PI * 1999;

            if (db.Open())
            {
                string query = "INSERT INTO logs VALUES('" +
                               test + "');";
                bool result = db.ExecuteNonQuery(query);
            }
            db.Close();
            return;
        }
Ejemplo n.º 3
0
        static void TestDataSet(string connstr, string driver)
        {
            DbEngineAdapter db =
                new DbEngineAdapter(connstr, driver);

            if (db.Open())
            {
                string query = "SELECT * from logs";

                DataSet   ds  = db.Execute(query);
                DataTable dt  = ds.Tables[0];
                int       i   = 0;
                int       max = dt.Rows.Count;

                while (i < max)
                {
                    DataRow dr = dt.Rows[i];
                    Console.WriteLine(dr[0]);
                    i++;
                }
            }
            db.Close();
            return;
        }