Click to See Complete Forum and Search --> : Changing field name on the fly


porpose
07-12-2007, 09:14 AM
Hey people QQ, which I would imagine isn't very difficult, yet I can't figure it out.

I'd like to change the label name of a field I'm displaying. Meaning, the name of the field in the DB needs to be adjusted on the fly when the page is rendered...not the data, just the field name. Can this be done?

Thanks for any assistance.

porp

gil davis
07-12-2007, 09:37 AM
Most people use "AS" in the SQL statement.

porpose
07-12-2007, 09:55 AM
Would you be able to help me employ that in the statements below? I'm not adept at all with SQL. The field I need to alter is "panelfieldid" as "email".


<%
set rs = conn.Execute("Select * from panelFields where (hidden=0 and viewable=1) and panelID=" & session("panelID") & " and panelfieldid <> 4717 order by OrderID")
while not rs.eof
data = rs("Data")
if isnull(data) then data = ""
vals = split(data, "!")
%>
<%=rs("name")%>:
<%
select case rs("Type")
case 3, 4:
if not isnull(attrRS("P" & rs("panelFieldID")) ) then
if attrRS("P" & rs("panelFieldID")) >= 0 and attrRS("P" & rs("panelFieldID")) <= ubound(vals) then
Response.Write(vals(attrRS("P" & rs("panelFieldID"))))
end if
end if
case else:
Response.Write(attrRS("P" & rs("panelFieldID")))
end select
%>

gil davis
07-13-2007, 06:25 AM
set rs = conn.Execute("Select *, panelFieldID AS whatever from panelFields where (hidden=0 and viewable=1) and panelID=" & session("panelID") & " and whatever <> 4717 order by OrderID")