This method can obtain the table name of ACCESS data, its structure, data type, etc... The program filters several hidden tables of several ACCESS databases (this may be the reason why the ACCESS database will become larger after deleting the data)
<html>
<head>
<title>Get ACCESS database table name_www.vevb.com</title>
</head>
<body style=text-align:left;margin-left:50px;font-family:'arial';font-size:12px>
<form style=padding:5px;margin:5px;margin-left:0px name=get action= method=post>
Database path:<input type=text name=path value= size=50 />
<input type=hidden name=ari value=1 />
<input type=submit value=View/>
</form>
<hr>
<%
if request.form(ari)=1 and request.form(path)<> then
dim conn,connstr,i,sql,rs
on error resume next
Connstr=DRIVER=Microsoft Access Driver (*.mdb);DBQ=+server.mappath(request.form(path))
Set Conn=Server.CreateObject(ADODB.Connection)
conn.Open connstr
If Err Then
err.Clear
SetConn=Nothing
Response.Write Database connection error, please check the connection string.
Response.End
End If
%>
<font color=red><%=conn.connectionstring%></font><hr>
<%
j=0
dim tablecount
tablecount=0
Set shm = conn.OpenSchema(20)
shm.MoveFirst
Do While Not shm.EOF
If shm(TABLE_TYPE) = TABLE Then
If Left(shm(table_name), 1) <> ~ Then 'Filter out hidden tables here
j=j+1
call GetFileds(shm(table_name))
End If
End If
shm.MoveNext
Loop
response.write There are &j& data tables in total!
else
response.write <h3>Please enter the relative path to the database to view the specific content!</h3>
end if
%>
</body>
</html>
<%
Function GetFileds(TableName)
Set rs = server.createobject(adodb.recordset)
Dim SQL
SQL = select * from & TableName
rs.Open SQL, conn, 1, 1
DimCont
Cont = rs.Fields.Count
response.write <div style=margin-bottom:10px;padding:5px;border:1px #dddddd solid;background:#eeeeee>&vbcrlf
response.write table <font color=red><b>&TableName&</b></font> contains &Cont& fields, as follows:<br>&vbcrlf
For i = 0 To Cont - 1
dimfiltype
select case rs.fields(i).type
case 3
filtype=automatic number(number)
case 202
filtype=character
case 203
filtype=remarks
case 125
filtype=date
case 11
filtype=true/false(yes/no)
end select
response.write <font color=red>&i&</font>--<font color=green><b>&rs.fields(i).name&</b></font>--&filtype&;<br />&vbcrlf
Next
response.write </div>&vbcrlf
rs.Close
set rs=nothing
End Function
%>