Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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:
VB
Error: 0
SL009: [Microsoft][ODBC Cursor Library] No columns were bound prior to calling SQLFetchScroll/SQLExtendedFetch
Error: 3146
ODBC--call failed.

The query is
SQL
select columnx from mytable where columnx = 123

There is no error if this is changed to
SQL
select * from mytable where columnx = 123

Why does using a specific column fail on some systems?
Posted
Comments
Sergey Alexandrovich Kryukov 20-Mar-15 10:09am    
Any specific reason to torture yourself with VB6, which was never a serious or even acceptable tool?
—SA
Vamshi Krishna Naidu 20-Mar-15 13:57pm    
@SA I Don't think the question here is Do I need to use VB6.
Sergey Alexandrovich Kryukov 20-Mar-15 14:39pm    
No it is not, so what? Still, let me ask my question, please. :-)
—SA
B1ueboy 20-Mar-15 15:53pm    
Inherited application; no choice. It's quite old, but still in use.

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?
 
Share this answer
 
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900