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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to connect asp to a MS Access Database

Status
Not open for further replies.

fmasin

Technical User
May 3, 2002
163
GB
Hi,

I'm relatively new to asp. I'm trying to build a dynamic website that will display available stock info to our customers, however, I seem not to be getting anywhere.

I have got a Microsoft Access Database, on a stand-alone machine....and I have tried the following code....but when I try the page, it's not displaying what I wnat. Looks like I have problems with my connection string.

<%@LANGUAGE="vbscript" %>
<%
Option Explicit
Dim MyConn, MyDB

Dim rs

Dim sql

Set MyConn=server.createobject ("ADODB.connection")
myDb= "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Test\AvStockasp.mdb"
MyConn.open myDb
set rs = server.createobject("ADODB.Recordset")
%>

<HTML>
<body bgcolor="#FFFFFF" TEXT="#000000">
<p align="centre"><Font face="Times New Roman, Times, Serif" size="4">Available Stock View
</Font></p>
<div align="centre">
<centre>

<%
sql="Select * from Available_Stock"
rs.open sql, MyConn,1,1
rs.movefirst
do until rs.eof
%>

Item: <%=rs("Description")%>
<br>
<%
rs.movefirst
Loop
rs.close
%>

</centre>
</div>
</form>
</body>
</html>

Many thanks for your help.

Thanks and regards,

Francis
 
Please, someone kindly help....I need to desperately get this going...

Thanks and regards,

Francis
 
how about we start with
1) what is the error you are getting
2) what are you trying to do

[smile]

try a OLEDB DSN-Less string for starters also
OLEDB

and a seperate tip...right click the actual database and copy/paste the location it is states as the location to the data source value. maybe the path is not what it seems [wink]

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
Hi onpnt,

Many thanks for your reply.

I'm actually not geting any error when I run the page.

I would like the page to display the Product Descriptions from the AvStock Table of my database.

When I run my asp form, no values from the database are being displayed. Not sure whether this is an IIS issue or not. However, I'm pretty sure that I have set up the IIS correctly.
The path for the database is correct.

Please, let me know where I might be going wrong.



Thanks and regards,

Francis
 
For a start maybe this
Code:
<%
    rs.movefirst
    Loop
    rs.close
%>

should be this

Code:
<%
    [b][red]rs.movenext[/red][/b]
    Loop
    rs.close
%>

and you need to use the correct syntax for this
Code:
<div align="centre">
<centre>

they should not be UK spellings

use [red]<center>[/red]



Chris.

Indifference will be the downfall of mankind, but who cares?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top