|
 |
asp_databases thread: ASP pages and hyperlinks
Message #1 by "Luke Noyd" <luke_noyd@h...> on Wed, 23 Aug 2000 14:44:24 CDT
|
|
My situation is this:
I have an ASP page that uses SQL to pull in 3 columns of data from a SQL
Server database into a table on my web page. The first column of data is a
foreign key to another table in my database. How can I set it up so this
row will link to another asp page that will query the table.
Message #2 by "Mike Scott" <jstmehr4u3@h...> on Wed, 23 Aug 2000 18:39:39 -0700
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C00D31.7E7DB4E0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
in your stored procedure, or sql statement, add a where clause that
states:
In this example i will show you how to get customername from the
customer table based on a foreign key, and records from the record
table.
select CustomerName, problem, product
from tab_Cust_info, tab_records
where tab_cust_info_uniqueid (foreign key in record table) =3D
tab_Cust_info.uniqueid (customerinfo table) and tab_record.recordid =3D
'2345'
----- Original Message -----
From: "Luke Noyd" <luke_noyd@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, August 23, 2000 12:44 PM
Subject: [asp_databases] ASP pages and hyperlinks
> My situation is this:
> I have an ASP page that uses SQL to pull in 3 columns of data from a
SQL
> Server database into a table on my web page. The first column of data
is a
> foreign key to another table in my database. How can I set it up so
this
> row will link to another asp page that will query the table.
>
>
> ---
> You are currently subscribed to asp_databases
$subst('Email.Unsub')
>
>
Message #3 by Yoram Zehavi <YoramZ@i...> on Thu, 24 Aug 2000 09:22:37 +0200
|
|
get the values from the other table with the first query you're doing and
the create a dynamic string with that values. (part of that string should
be: <a href=' [ value_from_table ] '> ..... </a>
-----Original Message-----
From: Luke Noyd
Sent: Wednesday, August 23, 2000 9:44 PM
To: ASP Databases
Subject: [asp_databases] ASP pages and hyperlinks
My situation is this:
I have an ASP page that uses SQL to pull in 3 columns of data from a
SQL
Server database into a table on my web page. The first column of data is a
foreign key to another table in my database. How can I set it up so this
row will link to another asp page that will query the table.
Message #4 by "Ray Murphy" <raymondmurphy@c...> on Thu, 24 Aug 2000 11:29:22
|
|
Luke,
The following code snippet may be what you're after - it basically trawls
through the Recordset, formats the data from the database into an HTML
table with column headers, formats the first column as a hyperlink to
another page and allows that page to be called with some values being
passed down ......
<TABLE border=1 CELPADDING="2" CELLSPACING="0" WIDTH=75%>
<TR>
' Output the Column Headers ...
<%For intCol = 0 To objRS.Fields.Count - 1 %>
<TD nowrap bgcolor="#000060" valign="top">
<FONT FACE="helvetica,verdana,arial" SIZE=4 COLOR="#99cccc"><B>
<% = objRS.Fields(intCol).Name%></B></FONT>
</TD>
<%Next%>
</TR>
<%
Do While objRS.AbsolutePage = iPageCurrent And Not objRS.EOF
%>
<TR>
' Output the Data Values ...
<%For intCol = 0 To objRS.Fields.Count - 1%>
<TD nowrap bgcolor="<%=strColor%>">
<FONT FACE="helvetica,verdana,arial" SIZE="2" COLOR="BLUE">
<% If IsNull(objRS.Fields(intCol).Value) Then
Response.Write " "
Else
IF intcol = 0 THEN 'Make the first column a link to
LinkedPage
'and pass down the first column and
second column
'to LinkedPage in the querystring %>
<A
HREF="LinkedPage.asp?FirstParamVal=<%=objRS.Fields(0)%>&SecondParamVal=<%=objRS.Fields(1)%>">
<%Response.Write objRS.Fields(intCol).Value & "</A>"
Else
Response.Write " " & objRS.Fields(intCol).Value
End If
End If
%></FONT>
</TD>
<%Next%>
</TR>
<%
objRS.MoveNext
Loop
%>
</TABLE>
Hope this helps.
Ray
|
|
 |