Issue with inserting dates

From: Javier Moreno (JavierMoreno_at_eaton.com)
Date: 01/26/05


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



Relevant Pages

  • Re: Code to get a Range RECTangle or PT
    ... > also fails with regards to split windows. ... >> Private Type RECT ... >> lDC = GetDC ... >> Sub GetRangeRect ...
    (microsoft.public.excel.programming)
  • Re: Help with email sub()
    ... Regards Ron de Bruin ... >> Regards Ron de Bruin ... >>> End Sub ... >>> Jose Luis ...
    (microsoft.public.excel.programming)
  • Re: On Error Resume Next
    ... If you are happy with your interpretation of how error handling works, ... Regards, ... >> Sub SetOnError() ... >> resume with Msgbox statement in calling procedure. ...
    (microsoft.public.excel.programming)
  • Re: Length of a dynamic link
    ... Public Sub Cells_Example ... 'If there isn't an active page, set vsoPage ... "John Goldsmith" wrote: ... Best regards ...
    (microsoft.public.visio)
  • Re: VS2005 BUG ??
    ... Regards, ... Steven Cheng ... Microsoft Online Support ... |> Private Sub Page_Init(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.framework.aspnet)