Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Jan 2005
    Posts
    165

    Unanswered: Creating hyperlink lookups...

    Hi again. I'm trying to make an applicaiton which involves searching for a particular case, allowing the user to pick a particular case, and then viewing the details about that particular case. Here is what I want to do. I have a page where a user types in a case number, phone number, etc. to search for. The search returns a list of results matching this criteria and makes the results hyperlinked. The user then clicks on one of the hyperlinked results to view the details of that particular case. I have some ASP knowledge...how easy would something like this be to create? Does anybody know of any tutorials available to do something like this? Thanks for any help.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I don't know of any tutorials, but it is pretty easy, basically you link from your search results page to you caseview page passing the case identifier in the url.

    You then request.querystring the case identifier and use it to run a full query against the database to return and display all the details for that case.

  3. #3
    Join Date
    Jan 2005
    Posts
    165
    Could you show me a sample of how you would like to it? I really don't know where to start b/c I've never done anything like this before. And the lack of tutorials doesn't really help.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Well that depends on where you want me to start,.... the search part? the creating the link part, the doing the individual look up. What do you current know about asp and databases? What tools are you using?

  5. #5
    Join Date
    Jan 2005
    Posts
    165
    I know how to connect to a database and query it through ASP using a searchbox and dropdown menus...I need help making the links. I'm using Dreamweaver 2004.

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Well I've never used dreamweaver so I can't really tell you how to do it with that...

    I can give you basic source code and instruction on how things hold together. Do you understand what dreamweaver does "under the covers"?

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Do you have a page that currently displays search results? If so, post it here and I will alter it to include a link

  8. #8
    Join Date
    Jan 2005
    Posts
    165
    I have access to visual studio .net 2003 if you use that...or what program do you use?

  9. #9
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Generally I'll use a Visual Studio product of some description. But like I said, do you have a working search page at the moment that displays results? if so, post that and I'll add a section in that creates the links.

  10. #10
    Join Date
    Jan 2005
    Posts
    165
    i dont' have it at the moment...i'm at home now and i won't be able to post it until tomorrow morning if that's okay with you?

  11. #11
    Join Date
    Jan 2005
    Posts
    165
    i thought it would be easier than it's going to be!

  12. #12
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    It's really not that difficult at all, but trying to explain it would probably take alot longer then just showing how it is done....

  13. #13
    Join Date
    Jan 2005
    Posts
    165
    I have two pages right now. I have a search.htm which contains a LastName and FirstName input boxes and a search button. The search.htm passes this information to search.asp, which is in the code below.

    Code:
    <html>
    <head><title></title><link href="../hcda.css" rel="stylesheet" type="text/css"></head>
    <body>
    
    <%
    
    'Variables
    Dim adoCon		'Connection Object
    Dim rsBan		'Recordset
    Dim strSQL		'SQL String
    Dim intNum		'Counting
    
    Set conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "Driver={SQL Server};" & _
               "Server=XXX.XXX.XXX.XXX;" & _
               "Address=XXX.XXX.XXX.XXX,1433;" & _
               "Network=DBMSSOCN;" & _
               "Database=PDData;" & _
               "Uid=XXXXXXX;" & _
               "Pwd=XXXXXXX"
    
    strSQL = "SELECT DefendantCase.CaseNumber, DefendantCase.LastName, DefendantCase.FirstName, DefendantCase.MiddleName, StatusDescription.[Description] AS Status FROM DefendantCase JOIN StatusDescription ON StatusDescription.StatusID=DefendantCase.StatusID WHERE LastName LIKE '%" & Request.Form("LastName") & "%' AND FirstName LIKE '%" & Request.Form("FirstName") & "%' ORDER BY DefendantCase.LastName"
    Set rsBan = Server.CreateObject("ADODB.Recordset")
    
    rsBan.Open strSQL, conn
    
    If rsBan.BOF and rsBan.EOF Then %>
    <table width="743" border="0" align="center">
      <tr align="left" valign="top"> 
        <td rowspan="2"><a href="http://www.houstonda.org"><img src="DAseal.jpg" width="320" height="319" border="0" alt="HCDA"></a></td>
        <td width="548" height="35"> 
          <div align="center"><font face="Georgia, Times New Roman, Times, serif"><b><font size="4">Houston County Information System</font></b></font></div>
        </td>
      </tr>
      <tr> 
        <td width="548" align="left" valign="top"> 
          <p>&nbsp;</p>
          <table width="50%" border="0" align="center">
            <tr> 
              <td align="left" valign="top"> 
                <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif"> 
                  <a href="index.asp">Home</a> | <a href="listall.asp">List All</a></font></div>
              </td>
            </tr>
          </table>
          <table width="99%" border="0">
            <tr> 
              <td align="left" valign="top">
                <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>The 
                  search yielded no results. Please try again.</b></font> 
                  <form action="search.asp" method="post" name="search" id="search">
                    <font face="Tahoma"> 
                    <table cellspacing="0" cellpadding="0" border="0">
                      <tr> 
                        <td valign="top">Last Name: </td>
                        <td valign="top"> 
                          <input type="text" name="LastName" size="25" maxlength="25">
                        </td>
                      </tr>
                      <tr> 
                        <td colspan="2" valign="top"> 
                          <div align="right"> 
                            <input type="submit" name="Submit">
                          </div>
                        </td>
                      </tr>
                    </table>
                    </font>
                  </form>
                </div>
              </td>
            </tr>
          </table>
          <p>&nbsp;</p>
        </td>
      </tr>
    </table>
    
    <% Else
    	Response.Write("<table width=960 border=0 bordercolor=#CCCCCC cellpadding=0 cellspacing=0 align=center>")
    	Response.Write("  <tr align=left valign=top> ")
    	Response.Write("  <td align=center><a href=index.asp>Home</a> | <a href=search.html>Search</a></td>")
    	Response.Write("</tr>")
    	Response.Write("</table>")
    	Response.Write("<div align=center><img src=head.jpg alt=HCDA border=0></div>")
    	Response.Write("<table border=1 bordercolor=#CCCCCC cellpadding=0 cellspacing=0>")
    	Response.Write("  <tr align=left valign=top> ")
    	Response.Write("    <td><font size=2></font></td>")
    	Response.Write("	<td><b><font size=2>Case Number</font></b></td>")
    	Response.Write("    <td><b><font size=2>Defendant</font></b></td>")
    	Response.Write("    <td><b><font size=2>Case Status</font></b></td>")
    	Response.Write("  </tr>")
    'If Not rsBan.EOF Then 
    '
    '
    Do While Not rsBan.EOF
    intNum = intNum + 1
    	Response.Write("  <tr align=left valign=top> ")
    	Response.Write("    <td width=15><font size=2>")
    	Response.Write(intNum)
    	Response.Write("</font></td>")
    	Response.Write(" <td><font size=2>")
    	Response.Write(rsBan("CaseNumber"))
    	Response.Write("</font></td>")
    	Response.Write("    <td><font size=2>")
    	Response.Write(rsBan("LastName"))
    	Response.Write(", ")
    	Response.Write(rsBan("Firstname"))
    	Response.Write(" ")
    	Response.Write(rsBan("MiddleName"))
    	Response.Write("</font>	</td>")
    	Response.Write("    <td><font size=2>")
    	Response.Write(rsBan("Status"))
    	Response.Write("</font></td>")
    rsBan.MoveNext
    
    Loop
    
    'End If
    End If
    
    rsBan.Close
    Set rsBan = Nothing
    Set adoCon = Nothing
    %>
    I would like the results hyperlinked so a user can click on a link, then show the details about a particular case. I'm sorry to have taken so long but things happen around the office. Thanks again for you help.

  14. #14
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I have attached a new version of that code for you. Basically I have added an extra column to the end of you table with the link. There is a variable set up to hold the page you want to got to and the querystring variable which you will need to change to point to whatever you want to call your page to display the full details.

    HTH.
    Attached Files Attached Files

  15. #15
    Join Date
    Jan 2005
    Posts
    165
    thank you for the page. it was very generous of you. i had no idea it was actually that simple. now i have a new question for you. how do i go about making the displayCase.asp page? i know the sql statement i want to use, but exactly how would i begin the page so it would display those results? thanks again for your help!!!!

    When I say how would i begin the page, i mean, how do i carry over that inforamtion from the previous page? Do I put a statement in my sql string? I'm thinking it will go in the WHERE clausse but i'm still unsure. Thanks for your help!
    Last edited by bla4free; 03-03-05 at 13:43.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •