ADO and ASP assistance

Moink

Artifact Armor
Adventurer
Joined
Jul 22, 2006
Messages
801
Location
Windurst Walls
Website
www.themoink.com
Main Job
WhiteMage-Male
Secondary Job
Summoner-Male
Third Job
Puppetmaster-Male
Server
Quetzalcoatl
Linkshell
Persephone
Confusing title for most people and for others not so much. This is for those that are comfortable with it and can help me with my coding problems.

ADO = ActiveX Data Objects
ASP = Active Server Pages

I want to build a database and display it on my personal website. It has been... 6+ years since I have gone near either Access or an ASP design.

I need help jump starting my current code and displaying it to the net.

<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "TestMagic.mdb"
set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM BasicTable", conn
do until rs.EOF
for each x in rs.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br />")
next
Response.Write("<br />")
rs.MoveNext
loop
rs.close
conn.close
%>
</body>
</html>

and when I check this .... I get this...

Microsoft JET Database Engine error '80004005'

Could not find file 'c:\windows\system32\inetsrv\TestMagic.mdb'.

/testasp/index1.asp, line 6

http://www.themoink.com/testasp/index1.asp

Whats the error? The Database is located in the same direcory... do i need to map the full path to it?
 
Last edited:
I would keep your database out of any web available directories. Even if you have to scope to it, yes.

C:\DB\myDB.mdb would be more secure.
 
YAY!

<html>
<head>
<title>The New Version</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
Dim adoCon
Dim rsDisplayArmor
Dim strSQL

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

adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("access_db/TestMagic.mdb")
Set rsDisplayArmor = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblEquipment.Head, tblEquipment.Body, tblEquipment.Hands, tblEquipment.Legs, tblEquipment.Feet FROM tblEquipment;"

rsDisplayArmor.Open strSQL, adoCon

Do While not rsDisplayArmor.EOF

Response.Write ("<br>")
Response.Write (rsDisplayArmor("Head"))
Response.Write ("<br>")
Response.Write (rsDisplayArmor("Body"))
Response.Write ("<br>")
Response.Write (rsDisplayArmor("Hands"))
Response.Write ("<br>")
Response.Write (rsDisplayArmor("Legs"))
Response.Write ("<br>")
Response.Write (rsDisplayArmor("Feet"))
Response.Write ("<br>")

rsDisplayArmor.MoveNext
Loop

rsDisplayArmor.Close
Set rsDisplayArmor = Nothing
Set adoCon = Nothing
%>

</body>
</html>

It works!!!!11111!!!11!!01010101!

What does this mean for me other then showing I R NRD?
Well It simply means that now I can apply all my context of my website into a database. Because I can now connect to a Database, this Database can grow and shrink and the website will grow or shrink with it! As I state on my website, there will be new versions or different or unique of the site, the database will allow me to keep all the text universal and i can change the look of the site or skins withtout having to retype new pages, the database will do this for me!

Thanks for the help Arc! ^^

http://www.themoink.com/test.asp
 
Back
Top