“没有列绑定”错误 [英] "No columns were bound" error

查看:70
本文介绍了“没有列绑定”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个VB6应用程序使用DAO查询链接服务器。最近发现查询在某些系统上失败。生成的错误是:

错误: 0  
SL009:[Microsoft] [ODBC游标库]没有列绑定之前 调用SQLFetchScroll / SQLExtendedFetch
错误: 3146
ODBC - 调用失败。



查询是

 选择 columnx 来自 mytable 其中 columnx =  123  



如果将其更改为

 选择 * 来自 mytable 其中​​ columnx =  123  



为什么在某些系统上使用特定列会失败?

解决方案

< blockquote>我会想象工作站之间的区别nd没有这个问题归结为正在使用的MDAC(Microsoft数据访问组件)库的版本。



更新到最新版本?


原因:Visual Basic 6不支持SQL数据类型VARCHAR(MAX)作为值在结果集中提供。 Option_Value是SQL数据类型VARCHAR(MAX)。

设置rs = OpenRS(SELECT [Option_Value] FROM [xSystemOptions] AS [xso] WHERE&_

[xso ]。[Option_Descr] ='PayoutEligibilityServices'和&_

[xso]。[Option_Value] ='1')

如果rs.EOF那么

PESMode = False

否则

PESMode =真

结束如果



修复:解决方法

设置resultSet = OpenRS(SELECT TOP 1 * FROM [xSystemOptions] WHERE&_

[Option_Descr] ='PayoutEligibilityServices' &_

AND [Option_Value] ='1')

如果resultSet.EOF那么

PayoutEligibilityServiceMode = vbFalse

Else

PayoutEligibilityServiceMode = vbTrue

结束如果


We have a VB6 application the queries a linked server using DAO. Recently the query is found to fail on some systems. The error generated is:

Error: 0
SL009: [Microsoft][ODBC Cursor Library] No columns were bound prior to calling SQLFetchScroll/SQLExtendedFetch
Error: 3146
ODBC--call failed.


The query is

select columnx from mytable where columnx = 123


There is no error if this is changed to

select * from mytable where columnx = 123


Why does using a specific column fail on some systems?

解决方案

I would imagine the difference between workstations that do and don't have this issue is down to the version of the MDAC (Microsoft Data Access Components) library in use.

Update to the latest available version?


Cause: Visual Basic 6 does not support SQL datatype VARCHAR(MAX) as value supplied in a result set. Option_Value is SQL datatype VARCHAR(MAX).
Set rs = OpenRS("SELECT [Option_Value] FROM [xSystemOptions] AS [xso] WHERE " & _
"[xso].[Option_Descr] = 'PayoutEligibilityServices' AND " & _
"[xso].[Option_Value] = '1'")
If rs.EOF Then
PESMode = False
Else
PESMode = True
End If

Fix: Workaround
Set resultSet = OpenRS("SELECT TOP 1 * FROM [xSystemOptions] WHERE " & _
[Option_Descr] = 'PayoutEligibilityServices' " & _
"AND [Option_Value] = '1'")
If resultSet.EOF Then
PayoutEligibilityServiceMode = vbFalse
Else
PayoutEligibilityServiceMode = vbTrue
End If


这篇关于“没有列绑定”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆