Solved

Search Tables on Access Database, With ASP

Posted on 1998-08-10
6
209 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 200 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

705 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