Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting Values using DBI::ODBC 1

Status
Not open for further replies.

Rieekan

Programmer
Apr 2, 2001
737
US
I'm attempting to save values to a memo field in an Access database, but when I attempt to insert with the statement below, it throws an error of 'Invalid Precision Value'. The problem is occurring when I have a value for $comments that is greater than 250 characters. (The max size for a Text field in Access).

Has anyone ran into this before and have any suggestions on how to fix this?

Code:
my %attr = { TYPE => 'SQL_LONGVARCHAR'};

my $comment = param('comment');

my $update = qq{insert into FUND_COMMENTS (FUND_CODE, USER_SEQ_ID, COMMENT) values (?, ?, ?)};

my $update_st = $fundsappdb->prepare($update) or keelover("Cannot prepare Comment Insert statement for fund $fund_code: ". $fundsappdb->errstr ." ", "2");

$update_st->bind_param(1, $fund_code);
$update_st->bind_param(2, $user_seq_id);
$update_st->bind_param(3, $comment, \%attr);

$update_st->execute() or keelover("Cannot execute Comment Insert statement for fund $fund_code: ". $fundsappdb->errstr ." ", "2");

Any and all help would be much appreciated!
 
I have figured out this problem It turns out that the documentation is slightly incorrect for the ODBC DB Driver. Once I changed my bind parameter to the following, it worked like a dream.

Code:
$update_st->bind_param(3, $comment, DBI::SQL_LONGVARCHAR);

Thanks to anyone that tried to help figure this out.

- George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top