> while ( $ary_ref = $sth->fetchrow_arrayref) {
>
> print FILE1 ("$ary_ref->[0] : $ary_ref->[1] : $ary_ref->[2] \n";
> print FILE1 ("$ary_ref->[0] \n";
> }
>
> 当运行的时候报告错误:
>
> DBD::ODBC::st fetchrow_arrayref failed: [Microsoft][ODBC Microsoft
> Access Driver
> ]字符串数据,右截断 在列号 3 (CopyDetail) (SQL-01004) at D:\jk\test1.pl line 31.
>
> [Microsoft][ODBC Microsoft Access Driver]字符串数据,右截断 在列号 3 (CopyDetail
> ) (SQL-01004) at D:\jk\test1.pl line 39.
>
>
> 我检查后发现,是由于第三列内容包含windows路径的"\"导致的,当运行到 while ( $ary_ref = $sth-
>> fetchrow_arrayref )的时候,就开始报告错误
>
> 请问各位,我该怎么做才能使perl正确读取"\"字符呢。
>
在你决定是 \ 的问题前,建议再仔细的 debug 一下。例如通过 use Data::
Dumer, 在每次循环时都 print Dumper $ary_ref;看看你的程序是否运行到这一
步,得到的结果是否正常。
另外也建议读一下这篇 debug 文章
http://wiki.perlchina.org/index.php/Brian%27s_Guide_to_Solving_Any_Perl_Problem
Qiang(James)
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina 论坛"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---
没有评论:
发表评论