date format changed with SQL
I am new in VB. My database(in Ms-Access) is containg a field "CURRENTDATE", I written a following routine to update CURRENTDATE :-
DIM CN AS NEW ADODB.CONNECTION
DIM CnStr AS STRING
CNSTR="PROVIDER................."
CN.OPEN CNSTR
RS.EXECUTE "UPDATE <TABLE NAME> SET CURRENTDATE = #" & NextDate & "#"
offcourse SQL updates records but in mm/dd/yyyy format while NextDate variable is well in dd/mm/yyyy format. My regional setting is dd/mm/yyyy.
VB Experts please tell me why is it so ?
Re: date format changed with SQL
try:
RS.EXECUTE "UPDATE <TABLE NAME> SET CURRENTDATE = format(NextDate,"dd/mm/yyyy")
Re: date format changed with SQL
First thing you got to check is the regional settings on the SQL Server, I going to assume that it is US. if so try settting NextDate as a string value or use one of these functions:
NextDate = Format(MyDate, "dd/mm/yyyy")
Andy
Don't forget to rate!!!
Andrew Lennon (Berlitz)
Automation Dev Engineer