I am having trouble loading an Access DB using Win32::ODBC. The code is loading a path and file name into a table and it fails when the path name contains an apostrophe: e..g, H:\DCIM\Paula's scrap book\P1.jpg.
If I remove the apostrophe, the field in the table is populated without error. Otherwise, I get the following in error:
Database insert error insert_jpg Subroutine: [-3100] [1] [0] "[Microso +ft][ODBC Microsoft Access Driver] Syntax error (missing operator) in +query expression ''H:\DCIM\Paula's scrap book\P1.jpg')'."
In the code example below, $j[0] = H:\DCIM\Paula's scrap book\P1.jpg
Can anyone tell me how to load this string without stripping out the apostrophe in Paula's?
Here is my code snippet:
$SqlStr = "INSERT INTO tbl_jpgs (jpg_seq, suborder, filename) VALUES( +$rcd,$i,'$j[0]')"; sub insert_jpg { my $SqlStr = shift; if ($objDC->Sql("$SqlStr")) { die "Database insert error insert_jpg Subroutine: " . $objDC-> Err +or() . "\n"; } }
Janitored by Arunbear - added code tags, as per Monastery guidelines
In reply to INSERT INTO problem with Win32::ODBC and MS Access by hcbsez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |