For my 'status', when i select 1 or more options, it will be split up by a comma and get my results..
But when i did not select anything, i will get an error:
Command Text not set to command object.
The results i want to get is that if i did not select 'status', it will display all results from status column.
Code:
If request.form ("status") <> "" Then
strSentence1 = request.form("status")
End If
strSen1 = Split(strSentence1, ", ")
sqlString = "SELECT * FROM Security_Vulnerability"
For x=0 to ubound(strSen1)
If x = 0 Then
sqlString = sqlString & " WHERE"
Else
sqlString = sqlString & " OR"
End If
sqlString = sqlString & " Status LIKE ('"& strSen1(x) &"%') AND Recipient LIKE ('"& strSentence2 &"%') AND Action_Taken LIKE ('"& strSentence3 &"%') AND Severity LIKE ('"& strSentence4 &"%') AND Week LIKE ('"& strSentence5 &"%') AND Class LIKE ('"& strSentence6 &"%') AND Business_Unit LIKE ('%"& strSentence7 &"%') AND Server_Name LIKE ('%"& strSentence8 &"%')"
rs_vServerName.Source = sqlString
Next
Response.write sqlString & "<br>"
rs_vServerName.CursorType = 0
rs_vServerName.CursorLocation = 2
rs_vServerName.LockType = 1
rs_vServerName.Open()
If rs_vServerName.eof Then
response.redirect ("No_Query.asp")
End If
ServerArray = rs_vServerName.GetRows
Thanks if anyone could help me see whats the problem.