This topic is locked

SQL Server 2005 and sessions

9/29/2007 11:56:08 AM
ASPRunnerPro General questions
author

Is there a way to grab the UserName and Now() values in SQL SERVER 2005? I use Session("UserName) and Now() in my ASP/Access apps, but SQL Server handles these variables differently, apparently.
Thanks.

D
dlangham 9/29/2007

You would use GETDATE() in SQL Server 2005 instead of NOW(), as for Session("UserName"), I would just pass it into a SQL Server field from the ASP page as normal.

Hope this helps.

500414 9/30/2007

You would use GETDATE() in SQL Server 2005 instead of NOW(), as for Session("UserName"), I would just pass it into a SQL Server field from the ASP page as normal.

Hope this helps.


Dale: Thanks for the info. I used GetDate() and am now getting this error: "Type mismatch: 'GetDate' " I am setting the field to read only and have used both GetDate() and GETDATE () as the default value.
Also - I'n not clear on how to do what you suggest regarding the username value. Thanks again.

Sergey Kornilov admin 10/1/2007

You can get better help explaining what the problem is.

500415 10/1/2007

You can get better help explaining what the problem is.


Okay. As I said at the top of this post, I'm looking for some guidance on getting the username and datetime session variables as values when editing records in a sql server 2005 database. In Access, I used Session("UserName) and Now(), but SQL Server handles these variables differently, apparently. I understand that sql server is an entirely different animal. GETDATE() did not seem to work either. That's really about all I know. Thanks.

Sergey Kornilov admin 10/1/2007

You need to explain what exactly is different because what you doing looks right.