예제 #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());
        }
예제 #3
0
        public List <string> GetKeyNames(String tableName)
        {
            var returnList = new List <string>();


            DataTable mySchema = MyAccessConnection.
                                 GetOleDbSchemaTable(OleDbSchemaGuid.Primary_Keys,
                                                     new Object[] { null, null, tableName });


            // following is a lengthy form of the number '3' :-)
            int columnOrdinalForName = mySchema.Columns["COLUMN_NAME"].Ordinal;

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

            return(returnList);
        }