Hi Folks,
I have the following bit of ASP that loops around a recordset and prints out the contents:
sub query2table(inputquery, inputDSN)
dim conntemp, rstemp
set conntemp=server.createobject("adodb.connection"
conntemp.open inputDSN
set rstemp=Server.CreateObject( "ADODB.Recordset"
rstemp.ActiveConnection = conntemp
rstemp.Open inputQuery
howmanyfields=rstemp.fields.count -1%>
<table border=1><tr>
<% 'Put Headings On The Table of Field Names
for i=0 to howmanyfields %>
<td><b><%=rstemp(i).name%></B></TD>
<% next %>
</tr>
<% ' Now lets grab all the records
do while not rstemp.eof %>
<tr>
<% for i = 0 to howmanyfields
thisvalue=rstemp(i)
If isnull(thisvalue) then
thisvalue=" "
end if
If isNum(thisvalue) then
formatCurrency(thisvalue,2)
end if
%>
<td valign=top><%=thisvalue%></td>
<% next %>
</tr>
<%rstemp.movenext
loop%>
</table>
<%
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
end sub%>
If the value of one of the fields is numeric I want it to be formatted like £0.00. I have tried the formatcurrecny method but it doesn't work - I get the following error:
Cannot use parentheses when calling a Sub
/FillingStation/lib_dbtable.asp, line 27, column 27
formatCurrency(thisvalue,2)
Can anyone help?
Nosh
I have the following bit of ASP that loops around a recordset and prints out the contents:
sub query2table(inputquery, inputDSN)
dim conntemp, rstemp
set conntemp=server.createobject("adodb.connection"
conntemp.open inputDSN
set rstemp=Server.CreateObject( "ADODB.Recordset"
rstemp.ActiveConnection = conntemp
rstemp.Open inputQuery
howmanyfields=rstemp.fields.count -1%>
<table border=1><tr>
<% 'Put Headings On The Table of Field Names
for i=0 to howmanyfields %>
<td><b><%=rstemp(i).name%></B></TD>
<% next %>
</tr>
<% ' Now lets grab all the records
do while not rstemp.eof %>
<tr>
<% for i = 0 to howmanyfields
thisvalue=rstemp(i)
If isnull(thisvalue) then
thisvalue=" "
end if
If isNum(thisvalue) then
formatCurrency(thisvalue,2)
end if
%>
<td valign=top><%=thisvalue%></td>
<% next %>
</tr>
<%rstemp.movenext
loop%>
</table>
<%
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
end sub%>
If the value of one of the fields is numeric I want it to be formatted like £0.00. I have tried the formatcurrecny method but it doesn't work - I get the following error:
Cannot use parentheses when calling a Sub
/FillingStation/lib_dbtable.asp, line 27, column 27
formatCurrency(thisvalue,2)
Can anyone help?
Nosh