2013年8月16日金曜日

MDBのカラム名とコメント取得

MDBのカラム名とコメント取得
 
DataTable schemaTable = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, new Object[] { null, null, null, "TABLE" });

foreach (DataRow dr in schemaTable.Rows)
{
    DataTable table = conn.GetSchema("Columns", new string[4] { null, null, dr["TABLE_NAME"].ToString(), null });

    DataRow[] table2 = table.Select("", "ORDINAL_POSITION");
    foreach (DataRow dr2 in table2)
    {
        List<string> col = new List<string>();
        col.Add("\"" + dr2["TABLE_NAME"].ToString() + "\"");
        col.Add("\"" + dr2["COLUMN_NAME"].ToString() + "\"");
        col.Add("\"" + dr2["DESCRIPTION"].ToString() + "\"");
    }

}

メモ書きとして。

0 件のコメント:

コメントを投稿