Here is a pretty standard Verify script which searches through a database for specific records and sends the user to the next page if the record is found. The problem the script seems to be unable to find certain records (6 our of 28 in this case). I have tried to reinput the numbers in the database and bounced back and forth signing in with a recognized number then trying one of the unrecognized ones but it consistently wont find certain numbers.
This is vexing. Does anyone have any idea why this would be happening?
This is really causing problems. I would really appreciate any help or direction.
Thanks
<%
Dim rs,strsql,conn,sql_update,ssn,hdDate,PageDate
set conn = server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")
'DSN less connection
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=d:\shared\Casework.mdb"
strsql = "Select ssn From cwct07 where ssn = '" & _
Request.Form("ssn") & "'"
set rs = conn.Execute (strsql)
If (not rs.BOF) and (not rs.EOF) then
session("ssn") = Request.Form("ssn")
Session("datetime") = Request.Form("hdDate")
Session("today") = Request.Form("PageDate")
Response.Redirect "http://cwpsalem.pdx.edu/staff/track/Completelogin.asp"
else
Response.Redirect "http://cwpsalem.pdx.edu/staff/track/beginAgain.asp"
end if
'close the recordset
rs.close
set rs = nothing
'close the connection
conn.close
set conn = nothing
%>
</BODY></HTML>
[/code]
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.
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.
It is a text field. I have checked for any space of tab or anything. I have also cleared the record and retyped it. Should I make it a number field? I will try that.
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.
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.
I just created 10 new records. 7 of them work. 3 of them don't. I input them all in exactly the same way. I also tried having indexing on and off, reordering the table by the ssn field, and restricting the number of characters in the field to 5. All to no avail. The numbers that don't work do not appear to have anything in common. There are no hyphens in the input as we are only asking for the last 5 digits. This is really frustrating.
The ssn is recognized correctly for all valid numbers and will update the correct record with a datestamp in the correct column.
When I include the conditional it will not recognize the input number consistently in random cases.
Is there a different way to do the conditional which might yield different results?
Thanks for your time.
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:
If you find it tedious to make a lot of closing statements just declare a few public variables and make two general functions for creating/opening af returning a recordset and one for closing. That's a time saver for ya'
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.