Hi
I have a form which has a dynamic list box containing data from a db. I have written a SQL query against a recordset and filled the recordset object with the results of the SQL query. Here is the query:
Dim objRS
Dim strSQL
Set objRS = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT FaultID FROM Faults WHERE Status= 'UnAssigned'"
objRS.Open strSQL, strConnect
If the SQL query has recordsets to return then this should be displayed:
<FORM ACTION="ProcessJob.asp" METHOD="POST">
<P><B>Select FaultID </B><SELECT NAME="FAULTID" SIZE="1">'
<%
Do While NOT objRS.EOF
Response.Write "<OPTION VALUE='" & objRS("FaultID"
& "'>"
Response.Write objRS("FaultID"
& "</OPTION>"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</SELECT></P><BR>
If the recordset is empty then I would like to display a message saying that all jobs have been assigned and not to display the form/list box. Is there any way of doing this with ASP? If anyone has an idea could they please help.
Thanks in advance.
I have a form which has a dynamic list box containing data from a db. I have written a SQL query against a recordset and filled the recordset object with the results of the SQL query. Here is the query:
Dim objRS
Dim strSQL
Set objRS = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT FaultID FROM Faults WHERE Status= 'UnAssigned'"
objRS.Open strSQL, strConnect
If the SQL query has recordsets to return then this should be displayed:
<FORM ACTION="ProcessJob.asp" METHOD="POST">
<P><B>Select FaultID </B><SELECT NAME="FAULTID" SIZE="1">'
<%
Do While NOT objRS.EOF
Response.Write "<OPTION VALUE='" & objRS("FaultID"
Response.Write objRS("FaultID"
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
%>
</SELECT></P><BR>
If the recordset is empty then I would like to display a message saying that all jobs have been assigned and not to display the form/list box. Is there any way of doing this with ASP? If anyone has an idea could they please help.
Thanks in advance.