Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Search Tables on Access Database, With ASP

Posted on 1998-08-10
6
Medium Priority
?
220 Views
Last Modified: 2013-12-25
I like Know the tables in a Access Database, but I like open and view with Access

Open Database with ADO and any trick to view existing tables.
0
Comment
Question by:juliomb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Author Comment

by:juliomb
ID: 1858924
Edited text of question
0
 
LVL 28

Expert Comment

by:sybe
ID: 1858925
Ok, here are the steps to take in ASP

First make an ODBC connection to the database (control panel, ODBC32). Remember the name you gave it, for the sample code below I'll call it "MyODBC"

The rest is ASP code, here are the steps.

<%
' make a connection to the ODBC source
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=MyODBC"
' Now you have a connection named "Conn"

' make a recordset

Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM MyTable"
'you can make any SQL statement that works in Acces
'including WHERE, JOIN ORDER BY etc
RS.Open strSQL, Conn, 1, 1
'Now you have the recordset

'Show the records in the page

Do While Not RS.EOF

  Response.write RS("FieldName1") & ", " & RS("FieldName2") & "<br>"

RS.MoveNext
Loop
RS.Close

' This loop will display the contents of all the records
' You might want to change the HTML design of it, but that is not hard to do.
%>









%>




0
 

Author Comment

by:juliomb
ID: 1858926
Hello Sybe.
Well, The code for open a Table it's know,

I not Know, its the name of table to operate with it.

I like a recordset with names of TABLES, not open a table.

Open Database, and know names of tables into databaseç

Thanks.


0
Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

 

Expert Comment

by:wanted
ID: 1858927
Your table's names in MSysObjects.(if you cann't see the table object, please check the  state in menu bar 'tool'->'option'->'system object' must be select)
If Type field is 1 and Flags field is 0, then Name field contain those table name.

select Name from MSysObjects where Flags=0 and Type=1
0
 
LVL 4

Accepted Solution

by:
mcix earned 400 total points
ID: 1858928
Try this:

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=YourODBCDSN"
Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * From MSysObjects Where Type =1 AND Flags= 0"
RS.Open strSQL, Conn, , , adCmdText
RS.MoveFirst
Do Until RS.EOF
    Response.write "TABLE NAME IS :" & RS("Name")& "<br>"
    RS.MoveNext
Loop

RS.Close
Conn.Close

%>

If you get an Access security error, check the permissions for the User you are logging in as and make sure they have BOTH read design and read data flagged on MSysObjects.

By default, Access does not even set the Admin user with the
ANY permissions for the MSysObjects table.

0
 

Expert Comment

by:wanted
ID: 1858929
Hi, juliomb:
you say:
>:Well, The code for open a Table it's know,
>:I not Know, its the name of table to operate with it.
>:I like a recordset with names of TABLES, not open a table.
so I told you "select Name from MSysObjects where Flags=0 and Type=1"
What's wrong? Why reject my ans.?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question