This topic is locked

New User infor

9/15/2008 6:05:43 AM
ASPRunnerPro General questions
T
tlalle author

I am trying this code in my events, and it is not wokring for me:
str = "select * from dbo.Employee where UserID=Session("UserID")

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection
if not rstmp.eof then

Session("username") = rstmp("FirstName")& " " & rstmp("LastName)
end if
rstmp.close

set rstmp=nothing
I want to make another session variable "username", from the same table that ASP authenticats the UserID... by cobining the fields "FirstName" & "LastName"

Sergey Kornilov admin 9/15/2008

If UserID a numeric field:

str = "select * from dbo.Employee where UserID=" & Session("UserID")


if UserID a text field

str = "select * from dbo.Employee where UserID='" & Session("UserID") & "'"
T
tlalle author 9/23/2008

str = "select * from dbo.NPSServiceLogons where Account='" & username & "' and password='" & password & "'"

Set rstmp = server.CreateObject("ADODB.Recordset")

rstmp.open str,dbConnection
if not rstmp.eof then

Session("MerchantID") = rstmp("MerchantID")

Session("BusinessName") = rstmp("BusinessName")
end if
rstmp.close

set rstmp=nothing
'setting cookies

response.cookies("MID").Expires=date+365

response.cookies("MName").Expires=date+365

response.cookies("MName")=SESSION("BusinessName")

response.cookies("MID")=SESSION("MerchantID")
this code is gving me a ASP SQL error... if I comment out he second session variable it works geat. How can I pull both variables?

Sergey Kornilov admin 9/23/2008

What event do you use and what is the exact error message?

T
tlalle author 9/23/2008

After successful login is the event. the error is:

ASP error happened
Technical information

Error number 3265

Error description Item cannot be found in the collection corresponding to the requested name or ordinal.

URL /supportlist/login.asp

SQL query select
from [dbo].[Services] where [Account]='ja1947' and [Password]='jahmed'

Solution There are no records in the recordset.
Please edit your event code in the following way:
strSQL = "select from AnyTable where AnyColumn='AnyValue'"
set rsTemp = CreateObject("ADODB.Recordset")
rsTemp.Open strSQLExists, dbConnection
and then use rsTemp("fieldname").
Or you can contact support team and send your event code. We'll help you.
More info on this error

If I comment out the one of the session variable statements, then it works fine.

Sergey Kornilov admin 9/23/2008

Make sure BusinessName and MerchantID fields exist in NPSServiceLogons table.

T
tlalle author 9/23/2008

NPSServiceLogons is a MS SQL view that did not contain "MerchantName" so I used the SQL query in ASPrunner to add the field. After reviewing your msg... i removed it from the ASP Runner SQL query... and edited the MS SQL view to include the field and it works. Thanks....