Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 7th, 2008, 05:52 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Classic

Can anyone help me? I do not know ASP at all.

I have an application that is currently working. But we want some changes to it.

Example:

Person A
123 Main St
xxx, xx, 12345
USA

Person B
234 Main St
xxx, xx, 12345
USA

The Person A and Person B and their addresses are fields in the database and rendered according to a query. However, we would like to add a static personal page for individual person. We have added a column in database for the static URL. But I do not what's involved in adding that URL field to the page. Can anyone help? Thanks
Reply With Quote
  #2 (permalink)  
Old March 7th, 2008, 05:59 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Without seeing a lick of your code I assume that you have some sort of form that displays the data you have shown above. You obviously would need to adjust the query that returns this data so taht it now includes the the URL of the persons home page and the code you would then use to write the data back out would be something like:

Personal URL: <%=rs("PersonURL")%>

where rs is your RecordSet object and "PersonURL" is the column that contains the persons url from your query.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Reply With Quote
  #3 (permalink)  
Old March 7th, 2008, 11:34 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the quick response. Here's the code:

<% If EmployeesAll <> "" Then
Response.Write "<table>"
Response.Write "<tr valign=""top"" align=""left""><td><B>Employee:</B></td></tr>"

MyEmployeesAll = Split(EmployeesAll, "|")

If IsArray(MyEmployeesAll) Then
For i = 0 to UBound(MyEmployeesAll) -1
  Response.Write "<tr align=""left"" valign=""top""><td align=""left""><TABLE BORDER=0><TR><TD>" & MyEmployeesAll(i) & "</TD></TR></TABLE></td></tr>"
Next
Else
  Response.Write "<tr align=""left"" valign=""top""><td align=""left""><TABLE BORDER=0><TR><TD>" & EmployeesAll & "</TD></TR></TABLE></td></tr>"
End If
Response.Write "</table><br>"
End If
%>


Correct me if I'm wrong, but i understand that the code will split up all the employees name. which will make it

Person A
Person B
Person C
...

So if I were to insert a link on the name itself, I figured it'll be at the red asterix? But how would I insert it?

<% If EmployeesAll <> "" Then
Response.Write "<table>"
Response.Write "<tr valign=""top"" align=""left""><td><B>Employee:</B></td></tr>"

MyEmployeesAll = Split(EmployeesAll, "|")

If IsArray(MyEmployeesAll) Then
For i = 0 to UBound(MyEmployeesAll) -1
Response.Write "<tr align=""left"" valign=""top""><td align=""left""><TABLE BORDER=0><TR><TD>" & * MyEmployeesAll(i) & "</TD></TR></TABLE></td></tr>"
Next
Else
  Response.Write "<tr align=""left"" valign=""top""><td align=""left""><TABLE BORDER=0><TR><TD>" & *EmployeesAll & "</TD></TR></TABLE></td></tr>"
End If
Response.Write "</table><br>"
End If
%>


Thanks again for the help!
Reply With Quote
  #4 (permalink)  
Old March 8th, 2008, 01:40 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You are correct on the first bit of code. It creates a table inside of a table row and writes out the current value of the array into a table cell.

You can insert a link by doing something like this (I have placed the new code in bold):

Response.Write "<tr align=""left"" valign=""top""><td align=""left""><TABLE BORDER=0><TR><TD><a href='somelink.asp'>" & * MyEmployeesAll(i) & "</a></TD></TR></TABLE></td></tr>"

does that make sense?


================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Reply With Quote
  #5 (permalink)  
Old March 9th, 2008, 10:06 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does that mean it'll be like this, if the URL is rendered from database?

Response.Write "<tr align=""left"" valign=""top""><td align=""left""><TABLE BORDER=0><TR><TD><a href='" & PersonURL &"'>" & MyEmployeesAll(i) & "</a></TD></TR></TABLE></td></tr>"
Reply With Quote
  #6 (permalink)  
Old March 10th, 2008, 07:41 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

That will work if the URL is always the same or you change the value of PersonURL with each loop. But yes, that should work.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Reply With Quote
  #7 (permalink)  
Old March 10th, 2008, 02:53 PM
Registered User
 
Join Date: Mar 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok .. I tried it and it doesn't work.

I have included

EmployeesURL = URLList(Rs("Employee_PK"))

Function URLList(strKey)
  Set Rs = Server.CreateObject("ADODB.Recordset")
  sql = "SELECT URL FROM Deptvw_ListEmployees WHERE REFTABLE_K = '" & strKey & "'"
  Rs.Open sql, Conn
  Do While Not Rs.EOF
    URLList = Trim(Rs("URL"))
    Rs.MoveNext
  Loop
  Rs.Close
  Set Rs = Nothing
End Function

And I have also added:

<% If EmployeesURL <> "" Then
Response.Write "<table>"
Response.Write "<tr valign=""top"" align=""left""><td><B>URL:</B> " & EmployeesURL & "</td></tr>"
Response.Write "</table><br>"
End If
%>

where did I go wrong? Thank you.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Threading in Classic ASP pcalixto Classic ASP Basics 2 January 10th, 2008 05:05 PM
Converting Classic Asp to Asp.Net 2.0 vikaspatyal ASP.NET 2.0 Professional 2 October 7th, 2007 06:33 PM
asp.net vs classic asp "URGENT" naeem_ul_hussan Classic ASP Professional 1 August 1st, 2007 03:14 PM
Using Classes in Classic ASP Help jonsey Classic ASP Basics 4 March 13th, 2007 12:34 PM
classic asp with asp.net on same iis bostonrose .NET Framework 2.0 6 January 10th, 2007 12:38 PM



All times are GMT -4. The time now is 02:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.