[PerlChina] 关于Win32::ODBC的问题

Uliyas Fan uliyas at gmail.com
Mon Mar 17 21:55:17 PDT 2008


大家好,
有谁用过Win32::ODBC插入一个'ntext'field的吗?SQL Server 2005的环境,我在插入时总是回报错。
在DB的表里看,这是一个不可见的字符,我用ODBC查询得到的是'\x00\x00\x00\x01',可用insert插入这样的字符到DB里就会报错'[Microsoft][ODBC
SQL Server Driver][SQL Server]Unclosed quotation mark after the character
string ''.'

谁能给一些指点呢。非常感谢!

here is my script:
----------------------
use Win32::ODBC;
use Encode;

$DSN = "DSN=automation;UID=sa;PWD=********";
$conn = new Win32::ODBC($DSN);

$a = "\x00\x00\x00\x01";

$sql = "insert into dcc_AgentCommand (CmdType, AgentType, CmdCreateTime,
CmdContentMD5, CmdCreateOwner, CmdContent) values(64, 256, '03/16/2008
10:00:00 AM', 'NoMD5', 2, '$b')";

#insert a record!!
$conn->Sql($sql);

----------------------

here is my perl version
C:\Documents and Settings\Uliyas>perl -v

This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 33 registered patches, see perl -V for more detail)

Copyright 1987-2006, Larry Wall

Binary build 819 [267479] provided by ActiveState
http://www.ActiveState.com<http://www.activestate.com/>
Built Aug 29 2006 12:42:41

Win32::ODBC's history

HISTORY
Last Modified 1999.09.25.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20080318/74cd97ed/attachment.html 


More information about the China-pm mailing list