Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 6th, 2007, 07:52 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Asp datetime problem with non-Unicode languages

  #1 Yesterday, 10:27 AM
neon20

Registered User
   Join Date: Mar 2007
Posts: 1
Time spent in forums: 4 m 32 sec
Reputation Power: 0

Asp datetime problem with non-Unicode languages

--------------------------------------------------------------------------------

hi everybody,

i have datetime problem with my access database

im not able to update the datetime field in the msaccess table using

objcon.execute "update users set us_userlastlogin='" & now() & "' where us_userid= '" & us_userid & "'"


i have non-Unicode language as Arabic in Regional and Language Option in the control panel. When i change this to US english erything works fine.

But if it is arabic, the query is works as

update users set us_userlastlogin='03/03/2007 05:44:21 ã' where us_userid= 'anas'

instead of

update users set us_userlastlogin='03/03/2007 05:44:21 PM' where us_userid= 'anas'

ie the datetime field doesnt accept ã character

is there any convert or alternative methods for this?

thank you
neon


Reply With Quote
  #2 (permalink)  
Old March 6th, 2007, 10:05 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You need to surround date values with #'s and drop the single quotes to insert dates. EG:

sql = "INSERT INTO tbleName (fieldname) VALUES (#" & now() & "#);"

Change your query to:

objcon.execute "update users set us_userlastlogin=#" & now() & "# where us_userid= '" & us_userid & "'"

Ano observation : if your us_userid is an integer also drop the surrounding single quotes. I guess this is a habit of myn pointing this out. UserID's are commonly integer fields however if your us_userid field is a string leave it as is.

Im sorry I can not help you with non-Unicode languages, i have no experience with this.

Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old March 7th, 2007, 02:29 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi matt
thank you for the reply

i tried # also and it didn't work. the userid field is text.

neon

Reply With Quote
  #4 (permalink)  
Old March 7th, 2007, 07:11 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Please define 'didnt work' what is your exact error, line number and the syntax on that line?

How do I get problematic SQL to work:
1..Comment out your execution line, response.write your statement and run the page.
2..Copy this syntax and paste it into the SQL window directley into Access. Does it work?
3..If not post the sql statement here indicating what data type the fields you use are EG:
   us_userlastlogin = date/time
   us_userid = text

Providing your two data types are as mentioned above, this should work:
objcon.execute "UPDATE users SET us_userlastlogin=#" & now() & "# WHERE us_userid='" & us_userid & "';"

NOTE
- The semi colon at the end is not a error correction, just good practice.
- Is there a value in the variable us_userid?

If it still doesnt work place this where ever you place your functions:
FUNCTION amDate(varDate)
   IF isNull(varDate) OR Trim(varDate) = "" OR varDate = "Null" THEN
      amDate = "Null"
   ELSE
      amDate = "" & Month(DateValue(varDate)) & "/" & Day(DateValue(varDate)) & "/" & Year(DateValue(varDate)) & " " & TimeValue(varDate) & ""
   END IF
END FUNCTION

And wrap it round your date value like so;
objcon.execute "UPDATE users SET us_userlastlogin=#" & amDate(now()) & "# WHERE us_userid='" & us_userid & "';"

This will insert a mm/dd/yyyy date type. What date type do you commonly use? Anyhow thats all I can think of. You need to post more specific errors.

Wind is your friend
Matt
Reply With Quote
  #5 (permalink)  
Old March 8th, 2007, 04:03 AM
Authorized User
 
Join Date: Mar 2007
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi matt

i could solve this problem by adding Session.LCID = 1033
in the global.asa

http://www.123hostnow.com/articles/LCID.asp

thank you very much for the helps that you provided.

neon


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp datetime problem with non-Unicode languages neon20 Classic ASP Databases 0 March 6th, 2007 07:49 AM
Asp datetime problem with non-Unicode languages neon20 ASP.NET 1.0 and 1.1 Professional 0 March 5th, 2007 11:50 AM
problem in unicode chandanbhakuni Classic ASP Databases 1 September 22nd, 2006 10:22 AM
How to implement unicode in asp web-pages? Swetz Classic ASP Databases 0 May 23rd, 2006 12:17 AM
Unicode ASP FIle Problem tks_muthu Classic ASP Databases 2 February 25th, 2005 06:45 AM



All times are GMT -4. The time now is 06:00 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.