This topic is locked

DAL Layer.

2/23/2009 1:10:09 PM
ASPRunnerPro General questions
R
Roger author

Hi all. I'm trying to update two columns in a table "After Successful Login". here is what I've got.
dal.Accounts.Value("IP_Address")=Request.ServerVariables("remote_addr")

dal.Accounts.Value("IP_Domain")=Request.ServerVariables("remote_host")

dal.Accounts.Update()
The reason for doing this is that we do not provide an Add/Edit page for users, just a List/View page. So we thought this a good place to capture this information.
Well, no errors (that's a good thing), but nothing gets updated.
We've checked the docs and can't get this to work. We can of course us SQL statements to do this, but we thought DAL would be easier and less cumbersome.
Can someone point us in the right direction?
btw: using eval version for the time being - just started about a week ago, so please be gentle <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=10995&image=1&table=forumtopics' class='bbc_emoticon' alt=';)' />

Sergey Kornilov admin 2/23/2009

You need to specify which record to update.

dal.UsersTable.Param("ID")=32
dal.UsersTable.Value("First Name")="Jim"
dal.UsersTable.Update()


More info:

http://www.xlinesoft.com/asprunnerpro/docs...scess_layer.htm

R
Roger author 2/23/2009

Thanks, I added these two lines and now all is well:
dal.Accounts.Param("Login_ID")=Session("UserID")

dal.Accounts.Update()

R
Roger author 2/27/2009

Hi again. I'd like to ask an additional question regarding this post.
The code I am using (see above) works exactly as intended (thanks admin for the pointer).
Anyway, I wanted to check the status of a Registration Field (sql BIT field: default to ZERO [0]).
When I check the value I get an error like so: Object doesn't support this property or method
My condition is (I saw a post somewhere with something similar, but can't find it now...)
if (dal.Accounts.Value("Registered") = 0) then

...some code...

end if
I can use sql to do this, but was hoping dal would be easier.
Not criticial, but a nice to use.
Thanks.

Sergey Kornilov admin 2/27/2009

Roger,
it doesn't work this way. To check the value of a certain field you need to retrieve it from the database first.
dal.Accounts.ID=32

set rs = dal.Accounts.FetchByID()

if rs("Registered")=0 then

...

end if