日期:2014-05-17  浏览次数:20867 次

如何读取access表中字段的说明?
比如:TABLE表中有字段id,name,sex,age,ID的字段说明是   ID号,name的说明是姓名,sex字段的说明是性别,age字段说明是年龄。我想读出ID号、姓名、性别、年龄这四个说明

------解决方案--------------------
<%@ Language= "VBScript "%>
<%
'------- 利用ADOX取得Access中字段的说明 ---------------
Function OpenConnectionWithString(strMDBPath, strTableName, strColName)
Dim cat
Set cat = server.CreateObject( "ADOX.Catalog ")
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= "&strMDBPath
OpenConnectionWithString = cat.Tables(strTableName).Columns(strColName).Properties( "Description ").Value
Set cat = Nothing
End Function

response.charset= "gb2312 "
response.Write OpenConnectionWithString(server.MapPath( "./数据库名称.mdb "), "表名称 ", "目标字段名称 ")

%>