예제 #1
0
        public override List <string> GetTableNames()
        {
            List <string> ret = new List <string>();

            MyAccessConnection.Open();
            DataTable dta = MyAccessConnection.GetSchema("Tables");
            string    table;

            foreach (DataRow r in dta.Select("TABLE_TYPE = 'TABLE'"))
            {
                table = r["TABLE_NAME"].ToString();
                ret.Add(table);
            }
            MyAccessConnection.Close();
            return(ret);
        }
예제 #2
0
        public override string GetPrimaryKey(string tableName)
        {
            MyAccessConnection.Open();
            List <string> tempList = new List <string>();
            DataTable     mySchema = MyAccessConnection.
                                     GetOleDbSchemaTable(OleDbSchemaGuid.Primary_Keys,
                                                         new Object[] { null, null, tableName });

            int columnOrdinalForName = mySchema.Columns["COLUMN_NAME"].Ordinal;

            foreach (DataRow r in mySchema.Rows)
            {
                tempList.Add(r.ItemArray[columnOrdinalForName].ToString());
            }

            MyAccessConnection.Close();
            return(tempList.First());
        }