View Full Version : ASP show mdb help!!

10-06-2007, 05:37 AM
I am trying to display my mdb database in the browser. The data is rendered into a table, however I am having a problem with a small bit of code.

Here is the code, this is not working for me:

<a href="update_form.asp?ID=" & "<%=rsHotelblock(("ID_no"))%>"><%=rsHotelblock("Hotel")%></a>

I want to autogenerate the link with column ID_no which references column Hotel as the link displayed. Final html should look like this:

<a href="update_form.asp?ID=1>Hotel Name</a>

but the code block above renders as
<a 1="" &="" href="update_form.asp?ID=">Hotel</a>

Can someone please show what I'm doing wrong?


10-06-2007, 01:46 PM
It's the old quotes in quotes problem. Try:

<a href='update_form.asp?ID="<%=rsHotelblock("ID_no")%>'><%=rsHotelblock("Hotel")%></a>

10-07-2007, 10:39 PM
thanks for the help, works great!!

10-08-2007, 03:02 PM
Not to deter from what Southwater said, but you can also do it this way:

<a href="update_form.asp?ID=<%=rsHotelblock(("ID_no"))%>"><%=rsHotelblock("Hotel")%></a>

You don't need to do a second set of quotes to get this to work.

10-09-2007, 08:01 PM
You can also escape the quotes with 2 quotes instead of one when inside a string

"<a href=""update_form.asp?ID=" & rsHotelblock("ID_no")& """>" & rsHotelblock("Hotel") & "</a>"