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>

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

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

No worries - happy to help. Could you mark the thread as solved by me? Cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.