How to get column descriptions from an access database in C #?

I am trying to get column descriptions for MS Access columns using C # (the text entered by the user in the table constructor to describe the purpose of the column). How can I do that? I thought maybe the ExtendedProperties in the column will contain this, but when I get the DataTable through OleDbConnection and iterate over the columns, ExtendedProperties always has a score of 0.

EDIT: Thanks, Remus, this did the trick. Below is a quick test in C #

            Catalog cat = new ADOX.CatalogClass();
            ADODB.Connection conn = new ADODB.Connection();
            conn.Open(_connectionString, null, null, 0);
            cat.ActiveConnection = conn;
            ADOX.Table mhs = cat.Tables["MyTableName"];
            string test = mhs.Columns["ColumnOfInterest"].Properties["Description"].Value.ToString();
+3
source share
1 answer

Using the ADOX directory, you can view the property of the Description field in VBA:

catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.FullName

Set tbl = catDB.Tables("New")

Set fld = tbl.Columns("Test")
Debug.Print fld.Properties("Description")
+2
source

Source: https://habr.com/ru/post/1790783/


All Articles