• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1922
  • Last Modified:

How do i display data on a HTML page or ASP

I am very new to programming, I want to display an html page or an ASP page with data from my access database and (or) from my Oracle which is installed on my local machine.
0
k0rxt2
Asked:
k0rxt2
  • 8
  • 4
  • 2
1 Solution
 
sajuksCommented:
0
 
aprestoCommented:
the above is spot on so im not here for points but normally:

0
 
aprestoCommented:
sorry pressed it to early:

1.  you need to create a connection to your database in the ASP page
2.  Store your info from the table in a recordset - read up
3.. exract your info from the recordset and write it to the screen using numerous methods which consist of, IF...END IF's, FOR...NEXT, DO WHILE...LOOP, WHILE...WEND

This all sounds like gibberish now but atleast you knwo what to look up, you will also need to learn a web script when using classic ASP such as VBscript or Javascript,i think vbscript is easier.

Good luck, and if in doubt just go to www.w3schools.com as sajuks has already mentioned
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
k0rxt2Author Commented:
ok I am trying this and it is failing, what ami doing wrong, the connection in the obdc was sucessful


<html>
<head>
<title>My First ASP Page</title>
</head>
<body bgcolor="white" text="black">

<%

Dim adoCon
Dim rsGuestbook
Dim strSQL

Set adoCon = Server.CreateObject("ADODB.Connection")


adoCon.Open "DSN=guestbook"
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")


Set rsGuestbook = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT tblComments.Name, tblComments.Comments FROM tblComments;"

rsGuestbook.Open strSQL, adoCon

Do While not rsGuestbook.EOF

         'Write the HTML to display the contents of the recordset'
      Response.Write ("<br>")
      Response.Write (rsGuestbook("Name"))
      Response.Write ("<br>")
      Response.Write (rsGuestbook("Comments"))
      Response.Write ("<br>")

      'Move to the next record in the recordset'
      rsGuestbook.MoveNext

Loop
'Reset server variables'
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>

</body>
</html>
0
 
sajuksCommented:
Whats the error that you are getting ? You're failing...in what ?
0
 
aprestoCommented:
try putting this before your While line:

IF not rs.eof THEN

and put this after the word loop

ELSE
      response.write "Sorry there are no records"
END IF
0
 
aprestoCommented:
try changing your database connection to this:

Dim strcon
Dim adocon
Dim dbvar

dbvar = ("guestboo.mdb")
Set adoCon = Server.CreateObject("ADODB.Connection")
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(dbvar)
adoCon.Open strCon
0
 
k0rxt2Author Commented:
I am this error

"Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x27c Thread 0xd84 DBC 0x20c484c Jet'.

/guestbook2.asp, line 16 "
0
 
aprestoCommented:
whats line 16:

here is a link to a similar prob

http://forums.aspfree.com/showthread.php?s=5b8a652fe4395ef6e425044a20fa2d2d&p=94987#post94987

Whats the structure of your database ie Table names, field names and some sample data, also whats the db called?
0
 
aprestoCommented:
sorry i know what its called reading back but what data?
0
 
k0rxt2Author Commented:
This  is just a test database I created in Access to test my connection, it had only with three columns " ID_nO, Name, and Comments" it has only 5 entries for test purposes nothing on line 16.
0
 
aprestoCommented:
>>>>[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x27c Thread 0xd84 DBC 0x20c484c Jet'.

/guestbook2.asp, line 16 "

there must be something on line 16:  try this page:

Showdb.asp

<%
Dim strcon
Dim adocon
Dim dbvar
Dim rs

dbvar = ("guestbook.mdb")
Set adoCon = Server.CreateObject("ADODB.Connection")
strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=; DBQ=" & Server.MapPath(dbvar)
adoCon.Open strCon

set rs = server.createobject("ADODB.recordset")

rs.open = "SELECT * FROM table", adocon

response.write "<TABLE">

If not rs.eof Then
    While not rs.eof
         response.write "<TR>"
         response.write "<TD>" & rs("ID_No") & "</TD>"
         response.write "<TD>" & rs("Name") & "</TD>"
         response.write "<TD>" & rs("Comments") & "</TD>"
         response.write "</TR>"
       rs.movenext
      Wend
Else
         response.write "<TR><TD>" & "There are no records" & "</TD></TR>"
End IF

response.write "</TABLE>"

%>

See how you get on with this one, in the SQL statement you may need to change the name of the table (...FROM table...) to what the table name is in your database.
0
 
k0rxt2Author Commented:
I have tried, I wonder if it is the version of access that I am running. now I am getting another error."A device attach to this system is not functioning." it has to something I am doing wrong or missing. I saved the page to (Inetpub\wwwroot\guestbook.asp). I will try it with the oracle I have installed on my machine, i doubt that it will make a difference, but I will give it a try. Thanks for your help, if you can think of anything else you can drop me an email.
0
 
aprestoCommented:
will do, thanks for the points and grade
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 8
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now