Hello,
I'm using classic asp with a text (flat file) database that doesnt like searches using "like" or left(field,N) so I'm trying wildcards.
I'm looking to see if a person exists in our database already and trying to account for typo's. The search is looking for partials on first and last name and year part of dob.
Here is my code for the search:
It seems to work only when its a single wildcard search (i.e. last name only) but that does not usually give me the correct person.
strsql = select mem_id from mem where RELATION = '01' and (DATE_OF_BIRTH like '1973%') and (LAST_NAME like 'Strou%') and (FIRST_NAME like 'Mel%')
If I do a manual search of the database using Strou, Mel, 1973 i get the correct person. I'm not getting an error, just not getting any data either.
What am i doing wrong? Any help is appreciated.
mfenn
I'm using classic asp with a text (flat file) database that doesnt like searches using "like" or left(field,N) so I'm trying wildcards.
I'm looking to see if a person exists in our database already and trying to account for typo's. The search is looking for partials on first and last name and year part of dob.
Here is my code for the search:
Code:
Dim strTempLast
Dim strTempFirst
Dim strTempDOB
strTempLast = left(strEmpLastName,5) + "%"
strTempFirst = left(strEmpFirstName,3)+ "%"
strTempDOB = left(strEDOB,4)+ "%"
dbconn3.open ImpactCS
GetImpMemName = "0"
strsql = "select mem_id from mem where RELATION = '01' and (DATE_OF_BIRTH like '" & strTempDOB & "') and (LAST_NAME like '" & strTempLast & "') and (FIRST_NAME like '" & strTempFirst & "') "
set rst10 = dbConn3.execute(strsql)
if not rst10.EOF then
strMyMEMID = trim(rst10.Fields("MEM_ID"))
End if
GetImpMemName = strMyMEMID
dbConn3.close
strsql = select mem_id from mem where RELATION = '01' and (DATE_OF_BIRTH like '1973%') and (LAST_NAME like 'Strou%') and (FIRST_NAME like 'Mel%')
If I do a manual search of the database using Strou, Mel, 1973 i get the correct person. I'm not getting an error, just not getting any data either.
What am i doing wrong? Any help is appreciated.
mfenn