Question: I am returning a value from my database. The data type is a string. I checked with TypeName. However, my if condition never works despite it printing the value I am checking for. Any ideas?

```
while NOT prs.EOF

    RecordStatus = prs("status")

    If (RecordStatus = "S") Then
        response.write("Scheduled!<br>")
        prs.MoveNext
    Else
        response.write(RecordStatus & "<BR>")
        prs.MoveNext
   End If

Wend
prs.Close

```

Answer: 
Also, consider placing MoveNext to last line.

```
while NOT prs.EOF

    RecordStatus = prs("status")    

    If (Trim(RecordStatus) = "S") Then
        response.write("Scheduled!<br>")
    Else
        response.write(RecordStatus & "<BR>")
    End If

    prs.MoveNext    
Wend
prs.Close

```
Same result, half the code:

```
do while NOT prs.EOF
    RecordStatus = ucase(trim(prs("status")))
    If RecordStatus = "S" Then response.write "Scheduled!<br>" Else response.write RecordStatus & "<br>"
    prs.MoveNext
loop
prs.close

```

You could also do this logic check with a case statement inside the SQL query itself:

```
select case lower(status) when 's' then 'Scheduled!' else status end as sresult from <yourdatabase>

```

Then use the code:

```
do while NOT prs.EOF
    sresult = prs("sresult") & "<br>"
    response.write sresult
    prs.MoveNext
loop
prs.close

```

Hope it help :)