PDA

View Full Version : data lookup


petertran123
10-25-2002, 09:21 PM
Hello,

I'm having a SSN field to do a look up: this is a code i'm using

strSQL = "Select SSN from vwpositiveTable"

Set conn = GetDBConnection(DATABASE_CONNECT_STRING)
Set rs = conn.Execute( strSQL )

If Not rs.EOF Then
rs.MoveFirst
while not rs.eof

SSN = Request.form("SSN")
rs.MoveNext
wend
End If

rs.Close

the problem i have is, the field only give me one value from last record..

here is an example: i have in database
SSN table containing value as below
1111111111
2222222222
3333333333
4444444444
5555555555
6666666666

when i try to look up for SSN 111111111 or 222222222 and is not found. I wanted to be able to see all the value from Row SSN in database, and do a look up from there.

in this matter. if someone is entering SSN 111111111 to 66666666 then they will ask to leave and no more application accept for this SSN because is already there. and

if they enter anything different SSN beside 111111111 to 66666666 then they are allowed to enter new application. I'm Sorry i can't explain well

Roy Sinclair
10-25-2002, 10:38 PM
Well as near as I can tell from the code fragment you posted, you could replace it with just this one line SSN = Request.form("SSN") to get the exact same result.

That line should be SSN = rs("SSN") instead but you need to do something else in that loop or all you're going to get is the last record from the recordset anyway. Perhaps if you explained what you want the field SSN to end up containing would help.

whammy
10-26-2002, 07:29 PM
<%
Dim SSN, conn, rs, strSQL

SSN = Request.Form("SSN")

strSQL = "Select SSN from vwpositiveTable WHERE SSN = '" & SSN & "'"

Set conn = GetDBConnection(DATABASE_CONNECT_STRING)
Set rs = conn.Execute( strSQL )

If NOT rs.EOF Then
'The SSN is already in the table
Else
'Sub here to fill out a new application or whatever
End If


rs.Close
Set conn = Nothing
%>

petertran123
10-28-2002, 09:56 PM
you guys are bravo :thumbsup: :thumbsup: :thumbsup: :thumbsup:

petertran123
10-29-2002, 08:54 PM
Whammy, can i call you teacher :)

would you please take a look at my code, there are an error with if...then..

strSQL = "Select PrimarySSN from positivetable WHERE
PrimarySSN = '" & strPrimarySSN & "'"

Set conn = GetDBConnection(DATABASE_CONNECT_STRING_HRAL)
Set rs = conn.Execute( strSQL )

If NOT rs.EOF Then

PreScreenAppDec = "A"
PreDecReason = "00"
'Holidayloan2()



If Request.Form("PriorYearFilingStat") <> Request.Form("CurrYearFilingStat") then
PreScreenAppDec = "D"
PreDecReason = "11"
FirstDecApp()
else
PreScreenAppDec = "A"
PreDecReason = "00"
Holidayloan2()
end if

Else
'Sub here to fill out a new application or whatever
PreScreenAppDec = "D"
PreDecReason = "24"
FirstDecApp()

end if

rs.Close
Set conn = Nothing

whammy
10-29-2002, 11:25 PM
Hmm... offhand, I don't see anything wrong. What's the error you're getting?

petertran123
10-30-2002, 01:21 PM
i saw an error has being occured under left hand corner at status bar...however, the code was ran fine,. at the bottom of status bar is normally appear a word "Done" now i'm getting a word "error" I double check my javascript but don't see anything wrong with that....maybe i missed something :confused: Thanks

petertran123
10-30-2002, 01:45 PM
i'm sorry for bothering you so much, i got it to fix Thanks so much

Roy Sinclair
10-30-2002, 09:06 PM
Peter,

Obviously you're running IE so when you see that "Error" you'll notice the icon in the lower left corner has also changed. You can click on that icon to get the details of the error. It's kept low key by IE to keep from disturbing the ordinary users but as a developer you need to know about that.

You can also turn on notifications about errors so you don't have to look for that error via Tools > Internet Options > Advanced > Display a notification about every script error.