Welcome to Dream.In.Code
Become an Expert!

Join 150,071 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,802 people online right now. Registration is fast and FREE... Join Now!




Searching Tables

 
Reply to this topicStart new topic

Searching Tables

meighlow
28 Feb, 2008 - 08:31 PM
Post #1

New D.I.C Head
*

Joined: 27 Jan, 2008
Posts: 15

Hello Dear Friends,

My current project is a job search site. I am using ASP with VBSCRIPT. Currently, users can select a salary range and view the SQL info that falls in that range. The data they can see is JobPostDate, JobName, JobSalary, and CompanyName. How do I enable the user to click on a job and view details, such as:Company address, ContactName, ContactEmail etc. The info is populated in the tables already. But since I am using a while loop, I don't know how they can select a job and drill down on it. The primary key is JobId. Here is the code:

vb

<%
do while Not rs.EOF
'response.write (rs("JobName") & " --" & rs("JobSalary") & rs("CompanyName") & "<br>")
response.write "<tr>"
response.write "<td>" & rs("JobPostDate") & " </td>"
response.write "<td>" & rs("JobName") & " </td>"
response.write "<td align = center>" & "$" & FormatNumber( rs("JobSalary")) & " </td>"
response.write "<td>" & rs("CompanyName") & " </td>"
response.write "</tr>"

rs.MoveNext
loop
rs.close
set rs = nothing
conn.close
set conn = nothing

%>


Thank you, as always, for your help.

Please use code tags when posting your code, it makes it much easier to read code.gif smile.gif

This post has been edited by PsychoCoder: 28 Feb, 2008 - 09:19 PM
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Searching Tables
28 Feb, 2008 - 09:24 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Well the easiest way to accomplish this in Classic ASP would be to put the job name into a hyperlink, like so:


vb

response.write "<td><a href=""JobDetails.asp?job_id="" & rs("JobId") & "">" & rs("JobName") & "</a> </td>"



Then on your job details page do a query based on your ID passed in the querystring, like so:


vb

Dim id As Integer
Set id = Cint(Request.QueryString("job_id"))
Dim sql As String
Set sql = "SELECT * FROM YourTable WHERE JobId =" & id


Then from there populate a table with the details about that job/employer. Hope that helps smile.gif
User is offlineProfile CardPM
+Quote Post

meighlow
RE: Searching Tables
29 Feb, 2008 - 10:41 AM
Post #3

New D.I.C Head
*

Joined: 27 Jan, 2008
Posts: 15

Thanks for your help, PsychoCoder. When I run the code, I am getting the following error:

Microsoft VBScript compilation error '800a0401'

Expected end of statement



response.write "<td><a href=""JobDetails.asp?job_id="" & rs("JobId") & "">" & rs("JobName") & "</a> </td>"
-----------------------------------------------------------------------^

The arrow is pointing to JobId. I did a response.write on JobId and the value is there. What could be causing this error?

Thanks so much!
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Searching Tables
29 Feb, 2008 - 12:22 PM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Ok, I truly enjoy helping people, but sometimes I think you should try to solve the little problems like this yourself. I mean you seems to want someone to do this for you. That error is because I inadvertly added extra quotes


vb

response.write "<td><a href=JobDetails.asp?job_id=" & rs("JobId") & ">" & rs("JobName") & "</a> </td>"


This post has been edited by PsychoCoder: 29 Feb, 2008 - 12:25 PM
User is offlineProfile CardPM
+Quote Post

meighlow
RE: Searching Tables
29 Feb, 2008 - 12:32 PM
Post #5

New D.I.C Head
*

Joined: 27 Jan, 2008
Posts: 15

Many apologies, PsychoCoder. I really appreciate your help. I promise in the future to exhaust all possibilities before posting.

Thanks again!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:00PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month