Hello all. I'll do my best to explain this. I've been having a bit of trouble figuring this one out. I have this application that queries the database (SQL Server) based on personnel and appointment date. I then perform GETROWS on the recordset for one field only (appttime) and this data is stored into an array. Please keep in mind that is only the section of the code where I'm running into a problem. The code follows:
Dim varChoseTime
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT persid, apptdate, appttime FROM appointments WHERE persid=" & intApptPersid & " AND apptdate='" & varApptdate & "'"
objRS.Open strSQL, conn
varChoseTime = objRS.GetRows(, , "appttime")
My data is as follows:
09:00:00
12:00:00
14:30:00
My problem is I can't figure out how to take this data and compare it in an If...Then statement as such:
If var0600am = "Yes" and varChoseTime <> "06:00:00" Then
Response.Write "<tr><td align=right>6:00 AM</td>" & "<td><input type=radio name=appttime value=06:00:00></td></tr>"
End If
If var0900am = "Yes" and varChoseTime <> "09:00:00" Then
Response.Write "<tr><td align=right>9:00 AM</td>" & "<td><input type=radio name=appttime value=09:00:00></td></tr>"
End If
If var1200pm = "Yes" and varChoseTime <> "12:00:00" Then
Response.Write "<tr><td align=right>12:00 PM</td>" & "<td><input type=radio name=appttime value=12:00:00></td></tr>"
End If
If var230pm = "Yes" and varChoseTime <> "14:30:00" Then
Response.Write "<tr><td align=right>2:30 PM</td>" & "<td><input type=radio name=appttime value=14:30:00></td></tr>"
End If
If var400pm = "Yes" and varChoseTime <> "16:00:00" Then
Response.Write "<tr><td align=right>4:00 PM</td>" & "<td><input type=radio name=appttime value=16:00:00></td></tr>"
End If
This works except it only looks at the first item in the array. It doesn't look at all the items in the array for each If..Then statement. All of these times are supposed to display if there are not in the array list.
Any and all help will be greatly appreciated.
Dim varChoseTime
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT persid, apptdate, appttime FROM appointments WHERE persid=" & intApptPersid & " AND apptdate='" & varApptdate & "'"
objRS.Open strSQL, conn
varChoseTime = objRS.GetRows(, , "appttime")
My data is as follows:
09:00:00
12:00:00
14:30:00
My problem is I can't figure out how to take this data and compare it in an If...Then statement as such:
If var0600am = "Yes" and varChoseTime <> "06:00:00" Then
Response.Write "<tr><td align=right>6:00 AM</td>" & "<td><input type=radio name=appttime value=06:00:00></td></tr>"
End If
If var0900am = "Yes" and varChoseTime <> "09:00:00" Then
Response.Write "<tr><td align=right>9:00 AM</td>" & "<td><input type=radio name=appttime value=09:00:00></td></tr>"
End If
If var1200pm = "Yes" and varChoseTime <> "12:00:00" Then
Response.Write "<tr><td align=right>12:00 PM</td>" & "<td><input type=radio name=appttime value=12:00:00></td></tr>"
End If
If var230pm = "Yes" and varChoseTime <> "14:30:00" Then
Response.Write "<tr><td align=right>2:30 PM</td>" & "<td><input type=radio name=appttime value=14:30:00></td></tr>"
End If
If var400pm = "Yes" and varChoseTime <> "16:00:00" Then
Response.Write "<tr><td align=right>4:00 PM</td>" & "<td><input type=radio name=appttime value=16:00:00></td></tr>"
End If
This works except it only looks at the first item in the array. It doesn't look at all the items in the array for each If..Then statement. All of these times are supposed to display if there are not in the array list.
Any and all help will be greatly appreciated.