示例#1
0
        // :::::::::::: Use this method to execute query by DataReader ::::::::::::
        public static OdbcDataReader getDataReader(string MyQuery)
        {
            OdbcConnection con   = new OdbcConnection();
            dbConnection   dbCon = new dbConnection();

            con = dbCon.dbConnect();
            con.Open();
            OdbcCommand cmd = new OdbcCommand(MyQuery, con);

            return(cmd.ExecuteReader());
        }
示例#2
0
        // :::::::::::: Use this method to return a DataTable from query string ::::::::::::
        public DataTable getDataTable(string MyQuery, string MyTable, string dsnName)
        {
            DataTable       dt     = new DataTable();
            OdbcConnection  con1   = new OdbcConnection();
            dbConnection    dbCon1 = new dbConnection();
            OdbcDataAdapter daGen1;
            DataSet         dsGen1;

            dsGen1         = new DataSet();
            dbCon1.dsnName = dsnName;
            con1           = dbCon1.dbConnect();
            daGen1         = new OdbcDataAdapter(MyQuery, con1);
            daGen1.Fill(dsGen1, MyTable);
            dt = dsGen1.Tables[MyTable];
            dsGen1.Tables.Remove(MyTable);

            return(dt);
        }