Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Aug 27, 1999



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Read Metadata With OpenSchema

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.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date