小晓谢
2015-01-19 12:26
采纳率: 100%
浏览 2.3k
已采纳

PB 经典问题 无解了!

database transaction information not available.call settrans or settransobject function.
就是这个事务问题! 我连的sql 05版本的数据库,然后编译出来再其他机器上运行就提示这个!度娘上面的神马方法都用过了。。。。还是不行。窗口settransobject(sqlca)然后retrieve()。。。。都检查了 都是有写的!程序处
sqlca.DBMS = "SNC SQL Native Client(OLE DB)"
sqlca.LogPass = '###'
sqlca.ServerName = "IP"
sqlca.LogId = "sa"
sqlca.AutoCommit = False
sqlca.DBParm = "Database='HXceshi'"
//connect using sqlcb;
//if SQLCa.sqlcode=0 then
//open(w_zhu)
//else
// messagebox("错误","连接数据库失败!失败信息"+string(sqlcb.sqlerrtext))
// end if

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • WorldMobile 2015-02-02 00:42
    已采纳

    告诉你在连接数据库的地方判断一下是否成功

    connect using sqlca; //这句话后要判断sqlca.sqlcode,看是否连接成功,如果未连接成功,提示一下原因
    open(w_zhu)

    改为

    connect using sqlca;
    if SQLCa.sqlcode=0 then
    open(w_zhu)
    else
    messagebox("错误","连接数据库失败!失败信息"+string(sqlca.sqlerrtext))
    end if

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • 小晓谢 2015-01-19 12:29

    后面用INI 帮看一下 哪错了。。
    string str_file
    //获取数据库配置文件,目录相对当前应用程序根目录
    str_file = "hx.ini"
    // 判断指定的INI文件是否存在
    if not FileExists (str_file) then
    messagebox("提示!","ini文件不存在!",exclamation!,ok!,2)
    return
    end if

    SQLCA.DBMS = ProfileString(str_file,"database","DBMS"," ")
    SQLCA.Database = ProfileString(str_file,"database","DataBase"," ")
    SQLCA.LogID = ProfileString(str_file,"database","LogID"," ")
    SQLCA.LogPass = ProfileString(str_file,"database","LogPassword"," ")
    SQLCA.ServerName = ProfileString(str_file,"database","ServerName"," ")
    SQLCA.UserID = ProfileString(str_file,"database","UserID"," ")
    SQLCA.DBPass = ProfileString(str_file,"database","DatabasePassword", " ")
    SQLCA.Lock = ProfileString(str_file,"database","Lock"," ")
    SQLCA.DbParm = ProfileString(str_file,"database","dbparm"," ")
    SQLCA.autocommit = false
    connect using sqlca;
    open(w_zhu)

    然后是INI文件
    [Database]
    DBMS="SNC SQL Native Client(OLE DB)"
    Database=
    UserId=
    DatabasePassword=
    LogId=sa
    LogPassword=###
    ServerName=IP
    DBParm="Database='HXceshi'"
    Lock=
    Prompt=FALSE
    AutoCommit=FALSE

    评论
    解决 无用
    打赏 举报
  • WorldMobile 2015-01-21 00:34

    sqlca.DBMS = "SNC SQL Native Client(OLE DB)"
    sqlca.LogPass = '###'
    sqlca.ServerName = "IP"
    sqlca.LogId = "sa"
    sqlca.AutoCommit = False
    sqlca.DBParm = "Database='HXceshi'"
    //connect using sqlcb;
    //if SQLCa.sqlcode=0 then
    //open(w_zhu)
    //else
    // messagebox("错误","连接数据库失败!失败信息"+string(sqlcb.sqlerrtext))
    // end if

    你的数据库压根没连接,connect using sqlca;这一行写的不对,

    sqlca.DBMS = "SNC SQL Native Client(OLE DB)"
    sqlca.LogPass = '###'
    sqlca.ServerName = "IP"
    sqlca.LogId = "sa"
    sqlca.AutoCommit = False
    sqlca.DBParm = "Database='HXceshi'"
    connect using sqlca;
    if SQLCa.sqlcode=0 then
    open(w_zhu)
    else
    messagebox("错误","连接数据库失败!失败信息"+string(sqlca.sqlerrtext))
    end if

    评论
    解决 无用
    打赏 举报
  • WorldMobile 2015-01-21 00:35

    和用不用ini文件无关

    connect using sqlca; //这句话后要判断sqlca.sqlcode,看是否连接成功,如果未连接成功,提示一下原因
    open(w_zhu)

    改为

    connect using sqlca;
    if SQLCa.sqlcode=0 then
    open(w_zhu)
    else
    messagebox("错误","连接数据库失败!失败信息"+string(sqlca.sqlerrtext))
    end if

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题