Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:06 PM
Rob
Guest
 
Posts: n/a
Default Changing Session.LCID in a hyperlink

Hi all,

Is it possible to change the Session.LCID in a hyperlink?
My problem is I'm calling a Date from a database to use as a querystring in
the hyperlink but I also need to display the date as output from the
hyperlink.
I need to have to querystring in Session.LCID = 1033 and the display date in
Session.LCID = 2057.

Coding :-

Session.LCID = 1033
<a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
rshelpdesk("date") & "</a></font></td>")

Whereever I put Session.LCID = 2057 I either get errors saying its in the
wrong place or It displays false. Tried the following that gives the false.

Session.LCID = 1033
<a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
Session.LCID = 2057 & rshelpdesk("date") & "</a></font></td>")


Any ideas?
Many thanks in advance,
Robert


  #2  
Old July 19th, 2005, 01:06 PM
Aaron Bertrand - MVP
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

Why are you using Session.LCID at all? How about formatting your date in a
standard, non-ambiguous format???

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




"Rob" <rob@rob.com> wrote in message
news:c7632o$25n$1@sparta.btinternet.com...[color=blue]
> Hi all,
>
> Is it possible to change the Session.LCID in a hyperlink?
> My problem is I'm calling a Date from a database to use as a querystring[/color]
in[color=blue]
> the hyperlink but I also need to display the date as output from the
> hyperlink.
> I need to have to querystring in Session.LCID = 1033 and the display date[/color]
in[color=blue]
> Session.LCID = 2057.
>
> Coding :-
>
> Session.LCID = 1033
> <a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
> rshelpdesk("date") & "</a></font></td>")
>
> Whereever I put Session.LCID = 2057 I either get errors saying its in the
> wrong place or It displays false. Tried the following that gives the[/color]
false.[color=blue]
>
> Session.LCID = 1033
> <a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
> Session.LCID = 2057 & rshelpdesk("date") & "</a></font></td>")
>
>
> Any ideas?
> Many thanks in advance,
> Robert
>
>[/color]


  #3  
Old July 19th, 2005, 01:06 PM
Rob
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

Could point, although not sure how to. The date is in uk format i.e.
dd/mm/yy in an access database. When I try and do a date range query in asp
it only works if I use the american format mm/dd/yy.
If you know of a way round this or how to do the formatting then I'd be
grateful.

Many thanks,
Robert


"Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in message
news:eu0otzTMEHA.1272@tk2msftngp13.phx.gbl...[color=blue]
> Why are you using Session.LCID at all? How about formatting your date in[/color]
a[color=blue]
> standard, non-ambiguous format???
>
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
>
>
> "Rob" <rob@rob.com> wrote in message
> news:c7632o$25n$1@sparta.btinternet.com...[color=green]
> > Hi all,
> >
> > Is it possible to change the Session.LCID in a hyperlink?
> > My problem is I'm calling a Date from a database to use as a querystring[/color]
> in[color=green]
> > the hyperlink but I also need to display the date as output from the
> > hyperlink.
> > I need to have to querystring in Session.LCID = 1033 and the display[/color][/color]
date[color=blue]
> in[color=green]
> > Session.LCID = 2057.
> >
> > Coding :-
> >
> > Session.LCID = 1033
> > <a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
> > rshelpdesk("date") & "</a></font></td>")
> >
> > Whereever I put Session.LCID = 2057 I either get errors saying its in[/color][/color]
the[color=blue][color=green]
> > wrong place or It displays false. Tried the following that gives the[/color]
> false.[color=green]
> >
> > Session.LCID = 1033
> > <a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
> > Session.LCID = 2057 & rshelpdesk("date") & "</a></font></td>")
> >
> >
> > Any ideas?
> > Many thanks in advance,
> > Robert
> >
> >[/color]
>
>[/color]


  #4  
Old July 19th, 2005, 01:06 PM
Aaron Bertrand - MVP
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

> Could point, although not sure how to. The date is in uk format i.e.[color=blue]
> dd/mm/yy in an access database.[/color]

NO! The date is not in any format inside the database. It is merely being
presented to you as such. To pass a standard, non-ambiguous date to Access,
which will never be misinterpreted, use #YYYY-MM-DD#.

http://www.aspfaq.com/2313
[color=blue]
> When I try and do a date range query in asp
> it only works if I use the american format mm/dd/yy.[/color]

Again, if you are trying to find rows that are >= 20040101 and <= 20040131
try

WHERE dateColumn >= #2004-01-01# AND dateColumn < #2004-02-01#

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


  #5  
Old July 19th, 2005, 01:07 PM
roger
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink


"Rob" <rob@rob.com> wrote in message
news:c768vm$mgq$1@sparta.btinternet.com...[color=blue]
> Could point, although not sure how to. The date is in uk format i.e.
> dd/mm/yy in an access database. When I try and do a date range query in[/color]
asp[color=blue]
> it only works if I use the american format mm/dd/yy.[/color]

Do you mean when using "#" to delimit dates?

I think if you use #01/11/2004# syntax in MS SQL, this will always mean

11th day of January

irrespective of any locale settings.

[color=blue]
> <a href=""applybankholiday.asp?date=" & rshelpdesk("date") & """>" &
> rshelpdesk("date") & "</a></font></td>")[/color]

How about...

dim d

d = rshelpdesk("date")

"<a href=""applybankholiday.asp?date=" & month(d) & "/" & day(d) & "/" &
year(d) & """>" &
d & "</a></font></td>"

However, I suspect nothing is foolproof for non-US date formats.


--
roger


  #6  
Old July 19th, 2005, 01:07 PM
Aaron Bertrand [MVP]
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

> I think if you use #01/11/2004# syntax in MS SQL, this will always mean[color=blue]
>
> 11th day of January
>
> irrespective of any locale settings.[/color]

No, this is incorrect on at least two counts.

(1) SQL Server will barf on # as delimiters. Run this in Query Analyzer:



DECLARE @dt SMALLDATETIME
SET @dt = #01/11/2004#



You will get this:



Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '#'.



(2) SQL Server will certainly *NOT* always interpret 01/11/2004 as January
11th. Even if you have a US locale and set up SQL Server as US English,
feel free to run this simple repro in Query Analyzer:



SET LANGUAGE FRENCH
GO

SELECT DATENAME(MONTH, '01/11/2004')

SET LANGUAGE ENGLISH
GO



Let us know if you get janvier or novembre!

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


  #7  
Old July 19th, 2005, 01:07 PM
roger
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

"Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
news:uTBwz4iMEHA.3052@TK2MSFTNGP12.phx.gbl...[color=blue][color=green]
> > I think if you use #01/11/2004# syntax in MS SQL, this will always mean
> >
> > 11th day of January
> >
> > irrespective of any locale settings.[/color]
>
> No, this is incorrect on at least two counts.
>
> (1) SQL Server will barf on # as delimiters. Run this in Query Analyzer:[/color]

True... but we were discussing MSAccess.

In that context, "MS SQL" was meant to mean the MS version of SQL included
with Access.


--
roger


  #8  
Old July 19th, 2005, 01:07 PM
Aaron Bertrand [MVP]
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

> True... but we were discussing MSAccess.[color=blue]
>
> In that context, "MS SQL" was meant to mean the MS version of SQL included
> with Access.[/color]

I think in 99% of all cases, MS SQL will be interpreted as SQL Server...
even if the discussion had previously involved a different platform.

And even with Access, #mm/dd/yyyy# is STILL not a safe format to use. The
only truly safe format to use in Access is #YYYY-MM-DD#


  #9  
Old July 19th, 2005, 01:08 PM
Bob Barrows [MVP]
Guest
 
Posts: n/a
Default Re: Changing Session.LCID in a hyperlink

roger wrote:[color=blue]
> In that context, "MS SQL" was meant to mean the MS version of SQL
> included with Access.[/color]

For future reference, that version is called "JetSQL", due to its use with
the Jet database most commonly used with Access (remember: Access is not the
database. Access is a front-end tool for working with several databases,
including Jet and MSDE).

Also, "MS SQL" will always be interpreted as MS SQL Server. The version of
SQL used by MS SQL Server is called Transact-SQL (often shortened to T-SQL)

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles