Hi all,
This is where I go when I can't figure it out, 'cuz you people rock!
Here's my code, seemingly simple enough:
I've tried with and without the loop, and in different places.
Here's the story: I have a Yes/No field in the recordset, [ynfldCheckInOut], that returns (obviously) -1 or 0. I want to replace that value in the html table with the text string "IN" or "OUT", depending (right now I'm just working with "IN").
Any assistance greatly appreciated!
This is where I go when I can't figure it out, 'cuz you people rock!
Here's my code, seemingly simple enough:
Code:
<%@ LANGUAGE="VBSCRIPT" %>
<%
Option Explicit
Dim conn
Dim rs
Dim strSQL
Dim strConnection
Dim AcctNum
Dim ItemNum
Dim i
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
strConnection = "FILEDSN=" & server.MapPath ("SACA.dsn")
AcctNum = Session("number")
conn.Open strConnection
strSQL = "SELECT nfldItemNum, ynfldCheckInOut, tfldArtist, tfldTitle, tfldLocation FROM tblItems WHERE nfldAccountNum=" & AcctNum & " ORDER BY idxItems ASC;"
set rs = conn.Execute (strSQL)
If (rs.BOF and rs.EOF) Then
Response.Write "No records found"
Response.End
rs.Close
conn.close
set rs=nothing
set conn=nothing
Response.End
End If
rs.MoveFirst
Do Until rs.EOF
[COLOR=#ff0000] Cstr(rs("ynfldCheckInOut"))
rs("ynfldCheckInOut").Replace("-1", "IN")[/color]
rs.MoveNext
Loop
Response.Write("<TITLE>" & Session("name") & " Collection</TITLE>")
Response.write("<left><b>" & Session("name") & " Collection, Account #" & Session("number") & "<br><a href=../asp/logout.asp>Logout</a></b></left><br>")
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<br>
<TABLE BORDER="1" CELLPADDING="2" CELLSPACING="1" WIDTH="100%">
<%
Response.Write "<TR BGCOLOR=""#CCCCCC""><TH>Item Number</TH><TH>IN or OUT</TH><TH>Artist</TH><TH>Title</TH><TH>Location</TH></TR>"
' -- Now output the contents of the Recordset
rs.MoveFirst
Do While Not rs.EOF
' -- output the contents
Response.Write "<TR>"
For i = 0 to rs.Fields.Count - 1
Response.Write "<TD><FONT FACE=""ARIAL"" SIZE=""1"">" & rs.Fields(i) & "</font></TD>"
Next
Response.write "</TR>"
' -- move to the next record
rs.MoveNext
Loop
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
%>
</TABLE>
</BODY>
</HTML>
I've tried with and without the loop, and in different places.
Here's the story: I have a Yes/No field in the recordset, [ynfldCheckInOut], that returns (obviously) -1 or 0. I want to replace that value in the html table with the text string "IN" or "OUT", depending (right now I'm just working with "IN").
Any assistance greatly appreciated!