752
社区成员
使用PB11.5+SQLSERVER+SNC链接数据库,如果要输入越南文则SQLCA.DBParm的参数需要带上DisableBind=0
否则无法存储越南文,如果带上DisableBind=0发现SQL语句中不能带变量,执行DEBUG显示SQL执行失败,求助大神解答
测试使用12.5同样的代码同样的环境带上DisableBind=0,可以输入越南文正常了。可现在不想升级12.5只想用11.5怎么办?
另测试使用ODBC可以单效能太差了,还对某些SQL语句语法有要求,之前的一些SQL使用ODBC无法正确执行了。
应用入口OPEN事件
// Profile wldbtest
SQLCA.DBMS = "SNC SQL Native Client(OLE DB)"
SQLCA.LogPass = "xxx"
SQLCA.ServerName = "xxx"
SQLCA.LogId = "xxx"
SQLCA.AutoCommit = False
SQLCA.DBParm = "Database='xxx',Provider='SQLNCLI10',DisableBind=0,TrimSpaces=1,NCharBind=1"
connect using SQLCA;
open(w_test)
加个按钮测试代码:
string ls_s, ls_trno
ls_trno = 'user'
select 'x' into :ls_s from dual where exists(select 'x' from secuser where userno ='user');
if sqlca.sqlcode <> 0 then
ls_s = '此处写死条件则成功'
messagebox("",sqlca.sqlerrtext)
end if
select 'x' into :ls_s from dual where exists(select 'x' from secuser where userno =:ls_trno);
if sqlca.sqlcode <> 0 then
ls_s = '如果带上DisableBind=0,只要SQL带变量则此处执行不成功'
messagebox("",sqlca.sqlerrtext)
end if
return 0
sqlca.sqlerrtext错误信息:
SQLSTATE = 42000
Microsoft SQL Server Native Client 10.0
無法從具有 sub-select 查詢的 SQL 陳述式衍生參數資訊。準備命令之前請先設定參數資訊。