/// <summary> ///gets the column name and description comment for the specified table name/// </summary> /// <param name= "Mdbfilepath" ></param> /// <param name= "TableName" ></param> /// <returns></returns> Public StaticHashtable Gettablefieldsdisfrommdb (stringMdbfilepath,stringtableName) {Hashtable TableFields=NewHashtable (); Try{ADOX. Catalogclass Cat=NewADOX. Catalogclass (); stringSaccessconnection = Strconnroot +Mdbfilepath; ADODB. Connection cn=NewADODB. Connection (); cn. Open (Saccessconnection,NULL,NULL, -1); Cat. ActiveConnection=cn; ADOX. Table TB=Cat. Tables[tablename]; if(tb!=NULL) { foreach(ADOX. Column ColinchTB. Columns) {stringColName =Col. Name.tostring (); stringColdis =""; foreach(ADOX. Property ProinchCol. Properties) {if(Pro. Name = ="Description") { if(Pro. Value! =NULL) Coldis =Pro. Value.tostring (); Break; }} tablefields.add (ColName, Coldis); }} Cat=NULL; cn. Close (); } Catch(System.Exception ex) {returnTableFields; } returnTableFields; }
C # reads the field names and their descriptions for the specified table in Access