I initially was having issues with the same thing, but through some
digging, found GOOGLED articles that suggest this as a fix...  I never
thought to use a VARCHAR though.

$sth->bind_param(3, '2004-05-05',{TYPE => SQL_DATETIME});

I'm not 100% sure about the syntax differences from just sending the
SQL_DATETIME as opposed to wrapping it in a hash as a "TYPE" and
remember some issues, but it could be that I was still banging my head
on the SQL_DATE problem at the time, so...  I always say..  Use what
works.

:)

Good luck.  HTH

Steven

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Peter Guzis
Sent: Wednesday, October 27, 2004 3:09 PM
To: John Deighan; [EMAIL PROTECTED]
Subject: RE: Prepared database handle problem


I've never had any luck using date/time specific data types with
DBD::ODBC.  Just use SQL_VARCHAR and you'll be fine.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
John Deighan
Sent: Wednesday, October 27, 2004 3:00 PM
To: [EMAIL PROTECTED]
Subject: Prepared database handle problem


The following simple script gives me the error message "Can't rebind 
placeholder 3 at C:\Scripts\temp.pl line 14." (i.e. at the execute()
call) 
and I can't figure out why. I'm using the DBD-ODBC driver and a SQL
Server 
database. The SqlStmtTestUtils.pm library just provides the getConn() 
function, and I've verified that the database handle is OK. The table 
involved was created with:

create table TestTable (
        ID integer         primary key,
        Name varchar(32)   unique,
        DateEntered smalldatetime null
        )

If I change SQL_DATE to SQL_VARCHAR, it works, but I'm using the ODBC 
standard date format, just like it says in the DBI documentation. Any
ideas?

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

use strict;
use DBI qw(:sql_types);
use SqlStmtTestUtils;

my $db = getConn();
my $sth = $db->prepare(<<"");
                insert into TestTable
                (ID,Name,DateEntered)
                values(?,?,?)

$sth->bind_param(1, 1,          SQL_INTEGER);
$sth->bind_param(2, 'John Doe', SQL_VARCHAR);
$sth->bind_param(3, '2004-05-05', SQL_DATE);
$sth->execute();

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to