当前位置: 代码迷 >> PB >> 实施sql语句,sqlcode值变为-1,什么原因啊
  详细解决方案

实施sql语句,sqlcode值变为-1,什么原因啊

热度:17   发布时间:2016-04-29 07:33:51.0
执行sql语句,sqlcode值变为-1,什么原因啊???
代码transacton sqlca连接数据库连上以后,只要遇到select-where语句,sqlcode就由0变为-1
执行connect后sqlcode变为0,但是遇到sql语句又变为-1
这是什么原因,请高手指教!!!
------解决方案--------------------
0 Success.
100 Fetched row not found.
-1 Error; the statement failed. Use SQLErrText or SQLDBCode to obtain the detail.

你用MessageBox("SQL error", SQLCA.SQLErrText)看看是什么
------解决方案--------------------
引用:
不是
gf_set_transaction_o 是取第一个数据库的表xt_login
这个表的内容是第二个数据库信息,此时还没有连第二个数据库


此时,LZ 应该检查一下是不是操控了不一至的 transaction !

select XXX into :ls_XXX from XXX where XXX using in_transaction;

if in_transaction.sqlcode <> 0 then
 messagebox(string(in_transaction.sqlcode), in_transaction.sqlerrtext)
end if
------解决方案--------------------
引用:
select servername,dbname,logid,logpass,dbms
into :ls_servername,:ls_dbname,:ls_logid,:ls_logpass,:ls_dbms
from xt_login
where login_type=:in_type ;

你写的sql语句都没有用到所定义的事务,默认的为sqlca,估计sqlca连接的不是这个库,所以会出现类型不匹配之类的~
  相关解决方案