This topic is locked
[SOLVED]

 USER login

6/29/2007 12:35:35 AM
ASPRunner.NET General questions
T
thecomputerguy author

I have this code:

CASES is my SQL table and a field is called cUSER.

I get an error when i do the following.
The error is this:

Compiler Error Message: BC30451: Name 'Cases' is not declared.
Source Error:
Line 9: 'Custom code

Line 10: 'put your custom code here

Line 11: Cases("cUSER") = CType(Session("User"), UserClass)

Line 12:

Line 13: Return True

Any Help is much appreciated. Thank you so much.
Public Shared Function BeforeEdit(Page As System.Web.UI.Page, e As SqlDataSourceCommandEventArgs) As Boolean
'Custom code

'put your custom code here

Cases("cUSER") = CType(Session("User"), UserClass)
Return True
' return true if you like to proceed with editing this record

' return false in other case

End Function

Eugene 6/29/2007

Please, advise what Cases("cUSER") stands for?

What would you like to get from this event?

T
thecomputerguy author 6/30/2007

Please, advise what Cases("cUSER") stands for?

What would you like to get from this event?



CASES is my SQL table and cUSER is the field inthe table. When i log in to the systemwith that Logid I want to use that logid when i to Edit and ADDs.
There is a session that holds that user id fromthe login screen. Can i use that logId and right before i do add or update some how store the value of the current user inthe Case("cUser") field?
Thank you.
Andrew

Eugene 6/30/2007

you can use next code in BeforeEdit event for table "Cases":
e.Command.Parameters("@cUSER").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserID
[codebox]Public Shared Function BeforeEdit(Page As System.Web.UI.Page, e As SqlDataSourceCommandEventArgs) As Boolean
'Custom code

'put your custom code here
e.Command.Parameters("@cUSER").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserID
Return True
' return true if you like to proceed with editing this record

' return false in other case

End Function[/codebox]

T
thecomputerguy author 7/1/2007

you can use next code in BeforeEdit event for table "Cases":

e.Command.Parameters("@cUSER").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserID
[codebox]Public Shared Function BeforeEdit(Page As System.Web.UI.Page, e As SqlDataSourceCommandEventArgs) As Boolean
'Custom code

'put your custom code here
e.Command.Parameters("@cUSER").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserID
Return True
' return true if you like to proceed with editing this record

' return false in other case

End Function[/codebox]

T
thecomputerguy author 4/14/2009

I have Version 4 for ASPRunner.net and wanted to add the user logged in tot he sustem to be saved during the UPDATE and ADD event,
I have the database field called LoginName in each of the tables.
So I thought by grabbing the sessions variable i could save or add it when the record is been update or ADD
e.Command.Parameters("@LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName
when i use that i get this error

Compiler Error Message: BC30456: 'Command' is not a member of 'System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs'.
Source Error:
Line 16: 'Custom code

Line 17: 'put your custom code here

Line 18: e.Command.Parameters("@LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName

Line 19:

Line 20: Return True

Eugene 4/15/2009

I have Version 4 for ASPRunner.net

e.Command.Parameters("@LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName
when i use that i get this error

Compiler Error Message: BC30456: 'Command' is not a member of 'System.Web.UI.WebControls.ObjectDataSourceMethodEventArgs'.


try to use next code:

e.InputParameters("@LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName

T
thecomputerguy author 4/15/2009



try to use next code:

e.InputParameters("@LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName


Hey Eugene,
When i put his code in before the Edit or add
'Custom code

'put your custom code here

e.InputParameters("@LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName

Return True
' return true if you like to proceed with adding new record

' return false in other case

I get this error when it updating..

Error description: Object variable or With block variable not set.
Any suggestions?
Thank you,
Andrew

Eugene 4/16/2009

I'm sorry, I've made a mistake.
The right code should be:

e.InputParameters("LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName

without "@"
Please, make sure that there is parameter LoginName in updateparameters/inserteparameters

T
thecomputerguy author 4/17/2009

I'm sorry, I've made a mistake.

The right code should be:

e.InputParameters("LoginName").Value = (CType(System.Web.HttpContext.Current.Session("User"), UserClass)).UserName

without "@"
Please, make sure that there is parameter LoginName in updateparameters/inserteparameters


How Can i do this with PHP?
Thank you

admin 4/18/2009

You can have better luck asking this in PHPRunner forum.