How do I read the names of tables and fields in an Access database? I tried OpenSchema, but I got the error, “The operation requested by the application is not supported by the provider.”
Your problem is in the Connection String you are using. On your Web server, you probably do not have the correct Access provider files installed. Instead, try using an ODBC connection. For example, to open an Access database and read tables, use this code. (Replace “FullpathnameofyourMDBfile” with the appropriate path as viewed from your Web server, not your development machine, if it is different).
Dim cnn1, rstSchema, strCnn Const adSchemaTables = 20 Set cnn1 = Server.Createobject("ADODB.Connection") strCnn = "DRIVER=Microsoft Access Driver (*.mdb);Persist Security Info=False;DBQ=FullpathnameofyourMDBfile;DefaultDir=FullDirectoryNameOfyourMDBfile" cnn1.Open strCnn Set rstSchema = cnn1.OpenSchema(adSchemaTables) Do Until rstSchema.EOF Response.write "Table name: " & _ rstSchema("TABLE_NAME") & " = " & _ "Table type: " & rstSchema("TABLE_TYPE") & "
" rstSchema.MoveNext Loop rstSchema.Close cnn1.Close set cnn1 = nothing
Note that you will get all Tables, including Access System tables from this code.