Issue with inserting dates
From: Javier Moreno (JavierMoreno_at_eaton.com)
Date: 01/26/05
- Next message: Ronald J Kimball: "RE: Issue with inserting dates"
- Previous message: Paul DuBois: "Re: max_allowed_package problem"
- Next in thread: Ronald J Kimball: "RE: Issue with inserting dates"
- Reply: Ronald J Kimball: "RE: Issue with inserting dates"
- Maybe reply: Ian Harisay: "Re: Issue with inserting dates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 26 Jan 2005 10:43:45 -0600 To: <dbi-users@perl.org>
All,
I have the following code:
$::sql = "INSERT into MASTER_Issue";
$::sql.= " (idIssue, Description, OpenDate, DueDate, idStatus, idPriority, idSeverity, SortDate)";
$::sql.= " VALUES (?,?,?,?,?,?,?,?)";
$::in{'MASTER_Issue.idStatus'} = "OPN";
@::values = (
$::in{'MASTER_Issue.idIssue'},
$::in{'MASTER_Issue.Description'},
"CONVERT(DATETIME,'$::in{'MASTER_Issue.OpenDate'}',20)",
"CONVERT(DATETIME,'$::in{'MASTER_Issue.DueDate'}',20)",
$::in{'MASTER_Issue.idStatus'},
$::in{'MASTER_Issue.idPriority'},
$::in{'MASTER_Issue.idSeverity'},
"CONVERT(DATETIME,'$::in{'MASTER_Issue.SortDate'}',20)"
);
$::reference = &SQL_Insert($::sql, @::values);
This will of course call a function that does all the work for me:
sub SQL_Insert {
my ($sql, @values) = @_;
# Prepare a SQL statement
my $sth = $::dbh->prepare( $sql ) or
&Error("Unable to prepare statement.");
# Execute the SQL statement
my $rc = $sth->execute ( @values ) or
&Error("Unable to execute statement", "$sql with values @values");
# Commit
$::dbh->commit;
}
However I am getting the following error on the webserver:
[Wed Jan 26 10:36:42 2005] [error] [client 151.110.117.153] Can't rebind placeholder 3 at Functions.pl line 285.\r, referer: http://slpmxwmorenojav/cgi-bin/EventConfirm.pl
Placeholder 3 is the convert function. How can I then insert a date value?
Regards,
Javier Moreno
- Next message: Ronald J Kimball: "RE: Issue with inserting dates"
- Previous message: Paul DuBois: "Re: max_allowed_package problem"
- Next in thread: Ronald J Kimball: "RE: Issue with inserting dates"
- Reply: Ronald J Kimball: "RE: Issue with inserting dates"
- Maybe reply: Ian Harisay: "Re: Issue with inserting dates"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|