?
Solved

Search Tables on Access Database, With ASP

Posted on 1998-08-10
6
Medium Priority
?
215 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

777 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