0

when I try running this asp using iexplorer, it does not return anything other than 'Country..... City..... Currency..... Population' as heading. How come it's not connecting and getting the data from the database?? Please help!
Thanks

<% @language = VBScript %>
<head>
<TITLE>ASP - Country Query</TITLE>
<body>
  <% 
     Dim MyConn, MydbFilePath
     Set MyConn = Server.CreateObject("ADODB.Connection")
     MydbFilePath = Server.MapPath("countrydb.mdb")
  
     MyConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & MydbFilePath & ";"
     query1 = "SELECT * FROM Countrytbl"
     Set RS = MyConn.Execute(query1)
  %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


Country..... City..... Currency..... Population<br><br>
<ul>
  <%
     WHILE NOT RS.EOF
  %>

     <li>
       <% =RS("Country") %> .....
       <% =RS("City") %> .....
       <% =RS("Currency") %> .....
       <% =RS("Population") %>
     </li>
  <%
       RS.MoveNext 
     WEND 
  %>
</ul>
</body>
</head>

Edited by vinumat: change of tags

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by WebspoonUK
0

Try replacing "MydbFilePath" with the actual hardcoded path of the access DB.

If you do response.write MyConn.State straight after your MyConn.Open, this should output a '1' or 'true' so you know you have an open connection

Within your <li> tags, try referencing your recordset fields like this: -

<%=rs.Fields("Country")%>

If you run the same query in Access, do you get results?

Hope this helps

0

Thanks a lot WebspoonUK ..That did really help me solve the problem. Thanks a million :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.