Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Contents of DB on a web page

Status
Not open for further replies.

pinto19

Vendor
May 22, 2005
29
US
Hi all,
Need to pick your brains please. I have a MS Access(Office XP) database that has 6 columns in table called "call off log". I want to be able to show those data in a webpage on the local intranet. I am using IIS of Windows 2000 Pro. Can this be done using asp pages as IIS can handle asp pages. Appreciate any help. The Db is saved in the c:\Data folder that IIS created as the root directory of name.

Thanks for your help.
 
BTW, the table "Call off log" is a linked table from an Excel file if that make's a difference.

Thanks
 
Set up a DSN on your local test machine with the same name as the DSN on your server. That way you can transfer pages from test to live without change.
Then display your stuff in a table:
First set the table up
Code:
<html>
<body>
<table align="center" width="70%" border="0" cellspacing="0" cellpadding="10">
	<tr>
          <th align="left" valign="top" width="15%"><p> UserName</p></th>
          <th align="left" valign="top" width="15%"><p> Order</p></th>
          <th align="left" valign="top" width="15%"><p> Item</p></th>
          <th align="left" valign="top" width="15%"><p> Quantity</p></th>
          <th align="left" valign="top" width="15%"><p> Email</p></th>
          <th align="left" valign="top" width="15%"><p> Shipped</p></th>
</tr>
<%
' then  open connection
Set ObjCon = Server.CreateObject("ADODB.Connection")
With ObjCon
	.Provider = "MSDASQL"
	.ConnectionString = "DSN=mydsn;UID=Admin;PWD=xxx;LockType=3;Mode = 3"
	.open
end with 
' set up query
StrReadAll = "SELECT * FROM [call log off]"
' get data
Set ObjRS = ObjCon.Execute(StrReadAll)
' loop to display
Do While Not ObjRS.EOF
%>
<tr>
          <td align="left" valign="top" width="15%"><p> <%= ObjRS.Fields(0) %></p></td>
          <td align="left" valign="top" width="15%"><p> <%= ObjRS.Fields(1) %></p></td>
          <td align="left" valign="top" width="15%"><p> <%= ObjRS.Fields(2) %></p></td>
          <td align="left" valign="top" width="15%"><p> <%= ObjRS.Fields(3) %></p></td>
          <td align="left" valign="top" width="15%"><p> <%= ObjRS.Fields(4) %></p></td>
          <td align="left" valign="top" width="15%"><p> <%= ObjRS.Fields(5) %></p></td>
</tr>
<%
ObjRS.MoveNext
Loop
' then tidy up closing RS and connection
ObjRS.Close
set ObjRS = nothing
objCon.Close
set objCon = nothing
%>
</table>
</body>
</html>

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Thanks for promt repsponse. Since I am very new to this, here is where i am getting lost.

StrReadAll = "SELECT * FROM [call log off]"
I have the DB saved in the fpdb folder. Do I change [call log off] to [\fpdb\call log off.md2]?

I made a page using the code you provied, saved as asp page , but when I run it in the server this is what I am getting ---"Microsoft OLE DB Provider for ODBC Drivers- Error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/view log.asp, line 17 "
I havent done anything other than that, You mentioned about setting up DSN, I dont know what that is.

Again sorry if I sound like an idiot, but I am very very new to this and please bear with me.
Thanks

 
Sorry I assumed you were further on. It looks as if you probably need to do some more background research. Start with MSDN:
and the Microsoft Knowledge Base:
From there do a search for DSN, and you will get several articles to give you an understanding of the background.
There is a good tutorial on the use of ADO (ActiveX Data Objects) here:
The actual setup for DSNs is done in Start|Control Panel|Data Sources.

The DSN provides the connection to the database. The query selects the required data from that database. Your DSN will point to the database wherever it is, and the query will point to the table within the db
To see what else needs to go in a web page start with the HTML and XHTML tutorials here:

It's a long hard road you've chosen - good luck on it. When you've done your basic studying you can always come back here for more info. Make sure you read faq222-2244 to find out how to get the best from these forums

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
to be more straight forward...

Go to Control Panel
then go to Administrative tools
then double click on ODBC Data sources...
then there will be 3 options...user DSN, System DSN and File DSN...

Select File DSN...Select Add New and add your Excel sheet...and name the DSN as whatever you want...

But i would also suggest you to do some research as john mentioned in his previous post...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top