[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 164
  • Last Modified:

Retrieve URL from database

I have a simple website that has some dynamic pages.  The pages load the names of forms and other documents that are stored in an Access database.  I also have in the database location of each form or document on the network.  What I am trying to do is hyperlink to the location specified in the database.


Example:

My Forms.asp page loads the names of each form stored in the database when opened.  When the user clicks on one of these form names, I want to open that form using the path that is also stored in the database.  How would I do that?  I am using Dreamweaver MX with ASP and MS Access.

If this is not clear, let me know and I will try to clarify.

Thanks.
0
sre22
Asked:
sre22
  • 4
  • 4
1 Solution
 
Saqib KhanSenior DeveloperCommented:
You have something Like page1.asp Stored in Database?

if thats the Case then simplly Follow the Given Example.

<a href="<%=rs("field_url")%>"><%=rs("field_url")%></a>

if I am not Clear or you are confused let me know so i can Assist you in a better way.
0
 
sre22Author Commented:
Here is what I have:

An access database with a table called "Files".  The table has these fields:

FileName  (Example: "Employee Computer Manual")
FileDescription (Example: "Computer Manual explaining how to use various software programs and applications")
FileLocation (Example: "I:\Manuals\Computer Manual.doc")

In my website (which is actually an Intranet) i have a page called Forms.asp that dynamically displays all the FileNames and FileDescriptions that are in my Access database.  That part works fine.  It lists each FileName and description as I wanted.  But my problem is that I want to be able to link to the actual file (Word doc, Excel, etc...) so that when the user clicks on a FileName that is displayed on Forms.asp, it will open the file by using the field in the database "FileLocation".

Maybe there is an easier way to do this so I'm open to suggestions, but this was the best way I could think of.  Hopefully this clears things up.
0
 
Saqib KhanSenior DeveloperCommented:
You Doing Good.

Where you printing File Names Do this
imagine these fields equall to your Fields in Database.

file_name = rs("file_name")
file_loc = rs("file_loc")

imagine this this in the LOOP That Prints all the File Names on your Page

<%=file_name%>

so to Link it to the Location

<a href="<%=file_loc%>">    <%=file_name%>  </a>

Did That Make Sense?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
sre22Author Commented:
ok.  I think I understand.  I am just learning Dreamweaver but still don't know very much html.  I created the dynamic data using a record set and I believe this is the code where it loads the data from the database:

While ((Repeat1__numRows <> 0) AND (NOT MGInfoForms.EOF))
%>
    <tr>
      <td width="302"><%=(MGInfoForms.Fields.Item("FileName").Value)%></td>  
      <td width="575"><%=(MGInfoForms.Fields.Item("FileDescription").Value)%></td>
    </tr>
    <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  MGInfoForms.MoveNext()
Wend

so using this, where would I put in your code?
0
 
Saqib KhanSenior DeveloperCommented:
> <td width="302"><%=(MGInfoForms.Fields.Item("FileName").Value)%></td>  

do this

 <td width="302"><a href="<%=MGInfoForms.Fields.Item("FileLocation").Value%>"><%=(MGInfoForms.Fields.Item("FileName").Value)%></a></td>  
0
 
sre22Author Commented:
Thank you so much!!!

I'm sure I'll have some more questions for you soon :)
0
 
Saqib KhanSenior DeveloperCommented:
Always Feels Good to help someone:).
Sure Bring it on.
0
 
sre22Author Commented:
ok.  posting a follow up to this one.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now