Here is a record set.
...
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
...
adoCommand.CommandText = strQuery
Set adoRecordset = adoCommand.Execute
And I need to check this recordset has some value or not.
If adoRecordset.Fields("userid").Value Then
'do something...
Else
'do something...
End If
I just tried to check but this code makes occurs an error.
(The Error message below is translated by Google)
ADODB.Recordset Error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal
If possible, I want to use Ternary operator.
I don’t know which part is wrong.
userid = adoRecordset.Fields("userid").Value ? adoRecordset.Fields("userid").Value : sw
Please understand that I’m a very newbie to asp, thank you.
You need to check for the existence of any rows in the resultset before attempting to access them by name:
There is no ternary operator in VBScript.