首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

PB调用存储过程的出错-解决思路

2012-02-11 
PB调用存储过程的出错--急急急!!sqlserver2000存储过程为:SQL codeALTERprocedure p_getmaxid(@tablename

PB调用存储过程的出错--急急急!!
sqlserver2000存储过程为:

SQL code
ALTER     procedure p_getmaxid(@tablename varchar(50),@preface varchar(50),@bh varchar(50) output)asbegin trandeclare @i intdeclare @curdate char(8)select @curdate=replace(convert(char(11),getdate(),121),'-','')update tablemax with(rowlock) set  @i=case when currentdate=@curdate then maxid+1 else 1 end, currentdate = @curdate,@bh= preface+@curdate+right(power(10,len)+@i,len),maxid=@i where preface = @preface and tablename=@tablename    commit tran

pb11.5中一个按钮中的调用为:
C# code
string bh,tablename,prefacetablename="bloodapp"preface="app"DECLARE pgetmaxid PROCEDURE FOR p_getmaxid @tablename=:tablename,@preface=:preface,@bh=:bh outputusing sqlca;execute pgetmaxid;if sqlca.sqlcode<>0 then     close pgetmaxid;    return else         FETCH   pgetmaxid   INTO   :bh;        if sqlca.sqlcode<>0 then             close pgetmaxid;            return         end ifend if


报错为:Database C0038:SQLSTATE=22005[ODBC SQL Server Driver]对于造型说明无效的字符串。 
试了好多次都不行,另外,通过DW调用存储过程时,为什么只要是带参数的存储过程都报错。


[解决办法]
ODBC连接数据库是有这个问题,我也遇到,没法搞定。
就只能改成oledb连接
[解决办法]
建议楼主直接用sql server专用接口连接数据库.

热点排行