This topic is locked

Field Values & Contents

2/27/2009 4:31:30 PM
ASPRunnerPro General questions
E
ErinSigma author

Is there a way I can access a colleciton of the Field Data and Values.
For example, when I enable Debugging, the top of the screen lists all the (I guess) variables used in the query for an appropriate page- example List.
The reason for the question is that I'm trying to set a field to a particular value during login in, but I am getting errors such as cannot do ... when the file is open and another one about record locked.
In some cases I've tried to use the DICT("varname") with no success. So it's clear I'm not looking at this correctly.
Still learning this product, so please bear with me.
Thanks
Erin <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=11047&image=1&table=forumtopics' class='bbc_emoticon' alt=':huh:' />
ps: I'm trying to use Before and After record add/update events if this helps.

Sergey Kornilov admin 2/27/2009

You need to check manual section specific to event you use.

For example in BeforeAdd/BeforeEdit events you can access any field content via dict("FieldName").
To print any variable on the page use:

Response.Write dict("FieldName")
E
ErinSigma author 2/27/2009

Thanks admin, yeah I go dict"(varname") working in add/update event etc.
But I can't seem to access certain field (columns) in the login page.
I'm guessing that this is because the login page only grabs up the username and password??? But looking at the login.asp code, all the folumsn are selected.
So, how can I access (and set) another fields during login and before displaying the main menu?
Thanks for the help.

Sergey Kornilov admin 2/27/2009

Check AfterSuccessfulLogin event that provides access to all fields in user record:

http://www.xlinesoft.com/asprunnerpro/docs...uccessful_login

E
ErinSigma author 2/27/2009

Somewhat really confused <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=38349&image=1&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />
I checked out all the events and docs before posting (and even searched) - and honest, I checked the docs VERYcarefully before posting.
In the Event Editor, the Header here says:
Sub AfterSuccessfulLogin(username,password).
In your link from your post, it's header is as follows (I don't think the $ sign has anything to do with anything here at all):
AfterSuccessfulLogin($username, $password, $data).
If there were access to a DATA array, all would be good and happy, but sadly, not that I could code or access.
So I'm not sure what I am missing. Which doc is correct? Neither seems to work as one would suspect, unless I am a complete putz - which is likely the case <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=38349&image=2&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
Please advise.
Thanks for the assist, is is appreciated.
Erin

Sergey Kornilov admin 2/27/2009

Erin,
my fault. It appears we only have this feature in PHPRunner.
This will be fixed in ASPRunnerPro 6.1. Meanwhile here is a simple code snippet that does the job in AfterSuccessfulLogin event:

set rs = dal.LoginTableName.Query("UserNameField='" & username & "' and PasswordField='" & password & "'","")


Now you can access any field from login table as rs("FieldName")

E
ErinSigma author 2/27/2009

Hi admin.
Certainly no fault here at all. Hope that wasn't your thought here.
Just that I was sitting here for a few hours pulling my hair out trying to figure out what I'm missing.
In any case, I tried your code snippet as follows:
set rs = dal.SecureUsers.Query("Acct_Login_ID=' " & username & " ' and Acct_PSWD=' " & password & " ' ")
I get this error:
*Error number 438

Error description Object doesn't support this property or method

URL /aspr/login.asp

SQL query select from [dbo].[SecureUsers] where [Acct_Login_ID]='test' and [Acct_PSWD]='test'

Pretty much what I've been getting all along.
Don't know what else to try. This is simply in the AfterSuccessfulLogin event. I've done nothng else, other than the code above. No attempt at update etc.
Hmmmm <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=38353&image=1&table=forumreplies' class='bbc_emoticon' alt=':huh:' />

Sergey Kornilov admin 2/28/2009

Erin,
your code looks good (assuming that all names are correct and there is no any other code in this event).
Post your application to Demo Account open a ticket at http://support.xlinesoft.com sending your application URL. I'll help you with this.

E
ErinSigma author 2/28/2009

Done, thank you for the assistance.
Erin

E
ErinSigma author 2/28/2009

Hi Sergey. I had sent the project up to the demo site yesterday as requested and posted the url.
Unfortunately, today I have to continue work on it. However, I saved the code snippet from the login page, so it need be I can put it back for your test.
Cheers for now.
Erin
ps: I believe I only have about 8 days left on the trial. Not that time is of the essence as I'm sure we're heading in this direction.

Sergey Kornilov admin 2/28/2009

Erin,
answered to personal email.
It needs to be on Demo Account server as we cannot troubleshoot it on your server.

Sergey Kornilov admin 3/1/2009

Here is the snippet that works. It ws missing the second parameter (WHERE).
I removed some unnecessary spaces as well.

set rs = dal.Accounts.Query("Login_ID='" & username & "' and Acct_PSWD='" & password & "'","")
E
ErinSigma author 3/1/2009

Erin,

answered to personal email.
It needs to be on Demo Account server as we cannot troubleshoot it on your server.


Hi Sergey. We tried to upload again and got errors (missed it the first time). I thnk it's because my machine is behind a firewall and it blocks outgoing FTP. Will check into this tomorrow.
In any case, I got it working. There was an erroneous space in the query which I removed and now it works fine.
Don't know how I could have missed it.
Anyway, I truely appreciate the help and I hope your time wasted wasted in waiting for me to upload again.
Also, should I go and "Close the Ticket" or will it just fall off the end of the world?
Again, thanks so much.
Erin <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=38385&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

E
ErinSigma author 3/1/2009

Here is the snippet that works. It ws missing the second parameter (WHERE).

I removed some unnecessary spaces as well.

set rs = dal.Accounts.Query("Login_ID='" & username & "' and Acct_PSWD='" & password & "'","")


Should have read all the posts before I replied to the previous one.
My code (a few posts back) had the second condition in it which is most likely what caused me to miss it.
When I ran the query in SQL, that's where I discovered the errroneous space (s).
Sooo relieved, I just couldn't believe that something so seemnlgly ssimple didn't work. Otherwise you folks would have had a small revolt on your hands.
Again, thanks for the time and effort, it is appreciated.
Erin.