PowerBuilder 未正确存储来自 SQL Server 的错误消息
在我们的应用程序中使用 DataWindow 中的 SqlErrText 时,我似乎遇到了一个奇怪的问题。
DataWindow 执行一个存储过程,我们将其称为 vp_ut_storedProc,在我的例子中,当 DataWindow 更新时它会抛出错误。
当我进入为应用程序构建错误消息的函数时,SqlErrText 按如下方式传入(作为参数 asErrText):
SQLSTATE = 42000
Microsoft SQL Server Native Client 10.0
TimestampNV|Someone Has Updated the Record. Please Refresh.
No changes made to the database
execute dbo.vp_ut_storedProc
我知道 PowerBuilder 会收到完整的错误文本,这是一件好事。但是,当我们尝试将错误文本保存到局部变量中时,
isErrText = asErrText
isErrText 的值为:SQLSTATE = 42000
因此,由于某种原因,它完全忽略第二行之后的所有内容。我认为这与 PowerBuilder 读取字符串的方式有关,但我不知道为什么会发生这种情况。
我还应该指出,它不仅限于这个数据窗口。其中相当多的人都会遇到这种情况。
I seem to be experiencing a strange issue when using the SqlErrText from a DataWindow in our application.
The DataWindow executes a stored procedure, lets call it vp_ut_storedProc, and in my case it throws an error when the DataWindow is updated.
When I go into the function to build the error message for our application, the SqlErrText is passed in as follows (as parameter asErrText):
SQLSTATE = 42000
Microsoft SQL Server Native Client 10.0
TimestampNV|Someone Has Updated the Record. Please Refresh.
No changes made to the database
execute dbo.vp_ut_storedProc
I know that PowerBuilder receives the entire error text which is a good thing. But, when we try to save the error text into a local variable
isErrText = asErrText
The value of isErrText is: SQLSTATE = 42000
So, for some reason, it completely ignores everything after the second line. I figure it has something to do with the way the PowerBuilder is reading in the string, but I don't know why this happens.
I should also note that it's not just limited to this one DataWindow. It happens on quite a few of them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其放入数据窗口的 dberror 事件中
如果插入或选择错误 。它忽略语法并输出错误。如果它是一个不同的错误。它显示了错误代码的其余部分
put this in your dberror event of your datawindow
if its insert or select error. it ignores the syntax and outputs the error. if its a different error. it shows the rest of the errcode