Is that a text field?
If not, remove the single quotes around the value.
If so, check that there are no "hidden" spaces or tabs in the actual DB values.
nikkiH
Junior Poster in Training
79 posts since Dec 2006
Reputation Points: 13
Solved Threads: 4
You can try that, but it's better to troubleshoot the real problem.
We had a problem with some newlines hiding in our text fields; for some reason, when we edited, and hit enter to go to the next record, the newline was also saved. Something to check for.
Also, ssn often has dashes, so leaving it text allows for more flexibility.
Also, you've got code here after a redirect. The way the code is written, a redirect of some sort will always occur. The code after it won't run. Just FYI.
nikkiH
Junior Poster in Training
79 posts since Dec 2006
Reputation Points: 13
Solved Threads: 4
You don't have an On Error Resume Next in that code anywhere, do you?
nikkiH
Junior Poster in Training
79 posts since Dec 2006
Reputation Points: 13
Solved Threads: 4
Well, when I expect only one match, I test only for EOF, not BOF.
i.e.
Set rs = Server.CreateObject("ADODB.recordset")
rs.Open strSQL, objSpecs, adOpenStatic, adLockReadOnly, 1
if rs.EOF then
Response.Write "<p><b>Error</b>: No matches found in the database for record </p>"
else
...
end if
nikkiH
Junior Poster in Training
79 posts since Dec 2006
Reputation Points: 13
Solved Threads: 4
Oh, and since it's a query, not a stored procedure, I don't use execute. I use open, which means I can get a record count if I want. You can't do that with execute.
Here's another example from some other code I have that might do either an exec or an open depending on other factors:
objRS.Open strSQL, objConn, adOpenStatic,adLockReadOnly, 1
...
' check for SQL errors
if Err.number <> 0 Then
Response.Write "<h2>An Error Occurred</h2>"
...
end if
on error goto 0
...
if objRS.RecordCount <= 0 then
recordcount = 0
if Not ObjRs.EOF then
while Not ObjRS.EOF
recordcount = recordcount + 1
ObjRS.MoveNext
Wend
ObjRS.MoveFirst
end if
else
recordcount = objRS.RecordCount
end if
debugOut "Record count is " & recordcount & ""
nikkiH
Junior Poster in Training
79 posts since Dec 2006
Reputation Points: 13
Solved Threads: 4