Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT help is needed

Status
Not open for further replies.

min460120

Programmer
Jun 23, 2001
9
US
Hi,

I'm not familiar with ASP. I'm working on a screen just kind of feedback form. This page need to show only once prior to main page.
In other words, when user access the main page,the request screen will show up first. User submit information from question screen and go to main screen do something and logoff. When user access the main page in the future, the request screen will never pop up.

I created a table to store the user id to trace the
user's access history for the question screen.

My following code intends to check if the user id exist. If yes, the request screen will not pop up.
My code doesn't work.
Could you tell me how to modify it? And, which event I should use to fire my code? Your help will be great appreciate.


SUB CHECK_USER_EXIST()
Set cmdRequest = Server.CreateObject("ADODB.Connection")
cmdRequest.Open application("ConnectionString")
cmdRequest.Mode = adModeReadWtrite

Set rsRequest = Server.CreateObject("ADODB.Recordset")
rsRequest.Open "TABLE", application("ConnectionString")

sql=""
sql="Select * from TABLE where USERID = '" & USER_ID & "'"
cmdRequest.commandtext = sql
rsRequest.Open cmdRequest, , 1, 3

If (rsRequest.recordcount > 0 ) then
set application("REQUEST SCREEN") = Nothing
end if
END SUB




 
One problem I can see is that you are using the recordcount property with a recordset opened with options 1,3. You need to use 3,3 for this property to work.

Change rsRequest.Open cmdRequest, , 1, 3 to
rsRequest.Open cmdRequest, , 3, 3


Brett Birkett B.Comp
Systems Analyst
 
Also, its better to use If not rsRequest.EOF then...
instead of If (rsRequest.recordcount > 0 ) then

Use this, it works 100% of the time, but people always seem to have trouble with the recordcount property. Brett Birkett B.Comp
Systems Analyst
 
Hi BBirkett,

Thanks for your great help. Just like you said I use
"not rsRequest.EOF" i.s.o. "recordcount" and it works well.
Thank you again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top