On Tue, 2005-04-12 at 23:34 -0700, Robb wrote:
> Does anyone have any idea what is up with Microsoft Access and its
> ridiculous Date/Time formatting options?
I asked that question daily in a previous life working with access, and
that that was with ms tools! I never got a sane answer.
I don't now if newer versions are any better but access 97 and 2000 both
had a nasty habit of sometimes ignoring any regional settings and just
using American dates.
As Bart suggested checking the regional settings for the box is worth
it. I would also check how the dsn is setup.
> $dt = "#4/5/2004 5:3:45 PM#";
>
> $sql = "INSERT INTO tblTest (TimeStamp) VALUES ($dt)";
>
> my $dbh = DBI->connect("dbi:ODBC:dsntest", "", "", { PrintError => 0,
> RaiseError => 1 })
> || die "database connection can't connect to database
> $DBI::errstr";
>
> my $sth = $dbh->prepare($sql) || die "prepare statement- $DBI::errstr";
> $sth->execute() || die "execute statement- $DBI::errstr";
> $sth->finish;
> .......................................................................
Do you get the same error if you use a bind value instead of putting $dt
directly in the string? ie
$sql = "INSERT INTO tblTest (TimeStamp) VALUES (?)";
$sth->execute($dt) || die "execute statement- $DBI::errstr";
Also have you tried ODBC date formats as your going through a DSN?
mark
--
This email (and any attachments) is intended solely for the individual(s) to
whom addressed.
It may contain confidential and/or legally privileged information.
Any statement or opinions therein are not necessarily those of ITN unless
specifically stated.
Any unauthorised use, disclosure or copying is prohibited.
If you have received this email in error, please notify the sender and delete
it from your system.
Security and reliability of the e-mail and attachments are not guaranteed.
You must take full responsibility for virus checking.
Independent Television News Limited,
Registered No. 548648 England,
VAT Reg. No: GB 756 2995 81,
200 Gray's Inn Road, London WC1X 8XZ,
Telephone: 020 7833 3000.