Access Table Exists?

Results 1 to 3 of 3

Thread: Access Table Exists?

  1. #1
    Join Date
    Dec 1969

    Default Access Table Exists?

    Hi,<BR><BR>I want to see if a table exists or not in an Access 97 database using ASP.<BR><BR>Is this possible?<BR><BR>Thanks!<BR><BR>Ben

  2. #2
    lagerBoy Guest

    Default RE: Access Table Exists?

    Without really thinking too much about it.<BR><BR>You could create a procedure (refer my posting yesterday) to create a Table in the database. If the table already exists you will get an error message, trap the error, and Voila! you know the table exists.<BR><BR>There is a better way to check if the table exists by directly querying the table schema so I&#039ll have a go at this after dinner, and give you the actual code to check if a table exists, but first, MUST EAT!

  3. #3
    lagerBoy Guest

    Default Post BBQ

    Try this, it should point you in the right direction.<BR><BR>&#060;%@ Language=VBScript %&#062;<BR><BR>&#060;%<BR><BR> dbString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:inetpubwwwrootyourPath.mdb;"<BR> y=0<BR> set adoxConn = server.createobject("adox.catalog")<BR> set adodbConn = server.createobject("adodb.connection")<BR> dbString<BR> adoxConn.activeConnection = adodbConn<BR> for each table in adoxConn.tables<BR> if table.type="table" then<BR> if Trim( = "Categories" then<BR> intTable = 1<BR> else<BR> intTable = 0<BR> end if<BR> end if<BR><BR> y = y & & "&nbsp;<BR>"<BR><BR> next<BR> adodbConn.close<BR> set adodbConn = nothing<BR> set adoxConn = nothing<BR><BR>&#039footnote: ADOX is an extension to the ADO objects and programming model. <BR>&#039ADOX includes objects for schema creation and modification, as well as security.<BR><BR>%&#062;<BR><BR>&#060;HTML&#062;<B R>&#060;HEAD&#062;<BR>&#060;/HEAD&#062;<BR>&#060;BODY&#062;<BR><BR>&#060;%<BR> Response.write y<BR> <BR> if intTable = 1 then<BR> Response.Write "Voila!"<BR> Else<BR> Response.Write "Didn&#039t find that table."<BR> End if<BR>%&#062;<BR><BR>&#060;/BODY&#062;<BR>&#060;/HTML&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts