Sorry -- first of all, please keep dbi-users on the mailing cc line or the
to line.  Others may see something I don't or be able to offer help that I
can't.

Since you are using ? for the place holders, you need to bind_param(N,xxxx,
yyyy) where N is the numerical order for the ?.  I.e.

        $sth = $dbh->prepare("insert into foo (a, b) values (?, ?)");
        while (get_my_data) {
                $sth->bind_param(1, $a_value, SQL_LONGVARCHAR);
                $sth->bind_param(2, $b_value, SQL_LONGVARCHAR);
                $sth->execute;
        }

Try that pattern and see if that works for you.

Jeff

> -----Original Message-----
> From: Brad Smith [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 09, 2002 8:14 PM
> To: Jeff Urlwin
> Subject: RE: Quirky problem with DBI
>
>
> Jeff:
>
> Still, no luck.  I have altered the code (below), but it fails with the
> following error.  PArdon my ignorance.  I am a newbie w/ DBI.  I was
> also wondering how a bind_param works in this situation, since I want
> to use a WHERE statement (like the #'d lines).
>
> The code:
>
>     my $dbh = DBI->connect("dbi:ODBC:gatekeepers") || die DBI::errstr;
>
> my $sth1->bind_param('case_notes1',undef,SQL_LONGVARCHAR);
>       $sth1->execute($in{'case_notes1'});
> my $sth2->bind_param('case_notes2',undef,SQL_LONGVARCHAR);
>       $sth2->execute($in{'case_notes2'});
> my $sth3->bind_param('case_notes3',undef,SQL_LONGVARCHAR);
>       $sth3->execute($in{'case_notes3'});
> my $sth4->bind_param('case_notes4',undef,SQL_LONGVARCHAR);
>       $sth4->execute($in{'case_notes4'});
>
>
> #    my $sth = $dbh->prepare("UPDATE gatekeepers
> #                              SET   case_notes1 = ?
> #                              WHERE sid         = ?
> #                            ") || die DBI::errstr;
> #
> #    $sth->execute($in{'case_notes1'}, $in{'sid'});
>
>     $dbh->disconnect();
>
> The error:
> Can't call method "bind_param" on an undefined value at c:/i-
> networks/soar/cgi-bin/collab_gatekeepers_channel_open.pl line 960.
>
> Thanks for your help.  I am under the gun right now, and nothing seems
> to be working correctly.
>
> Brad Smith
>
>
>
>
> On 9 Sep 2002 at 18:12, Jeff Urlwin wrote:
>
> > Yes, access is sometimes quirky about longs/memos.  Try doing this (in
> > pseudo code) (warning, may wrap long lines):
> >  #!perl -w
> >  # above line makes sure perl is running with warnings.
> >  use strict; # make sure we have strict on to check for dumb typos
> >  use DBI qw(:sql_types); # make sure we use DBI and import type names,
> >  such
> > as SQL_LONGVARCHAR
> >  connect()
> >  $sth = prepare()
> >
> >   # only for memos/long fields, where N is the column number
> >  $sth->bind_param(N, undef, SQL_LONGVARCHAR);
> >
> >  etc
> >
> >  $sth->execute(args)
> >
> > If that fails for some reason, let me know.  The fall back is to use
> > bind_param() for each of them and pass no arguments to execute().
> >
> > Regards,
> >
> > Jeff
> >
> > >
>
>


Reply via email to