Problem with several SQL datatypes

Discussions related to Visual Prolog
Gela Chankvetadze
Posts: 7
Joined: 12 Dec 2006 16:01

Problem with several SQL datatypes

Unread post by Gela Chankvetadze » 30 Jan 2020 9:36

I am using ODBC example to connect to my database. Everything works fine unless I select from a table which contains cell(s) of type TEXT, NTEXT, VARCHAR(max) or NVARCHAR(max). The later two datatypes work if 4000 is specified instead of max.

The error description is given below. Is there any fix to this problem?


----------------------------------------
Native ODBC exception

StatementString = select * from [F100]
ChildClassName = odbcStatement
SqlState = 07009
NativeErrorCode = 0
NativeErrorMessage = [Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index
FieldInfo = sQLGetData

native (odbc_exception)
odbcBufferSupport::getData
pfc\odbc\odbcBuffer\odbcBufferSupport\odbcBufferSupport.pro(279,9)
----------------------------------------
c:\program files (x86)\visual prolog 9\pfc\exception\exception.pro(212)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipKernel.dll (0x14008BD9)
c:\program files (x86)\visual prolog 9\pfc\exception\exception.pro(212)
c:\program files (x86)\visual prolog 9\pfc\exception\exception.pro(207)
c:\program files (x86)\visual prolog 9\pfc\odbc\odbcsupport\odbchandle.pro(225)
c:\program files (x86)\visual prolog 9\pfc\odbc\odbcsupport\odbchandle.pro(163)
c:\program files (x86)\visual prolog 9\pfc\odbc\odbcbuffer\odbcbuffersupport\odbcbuffersupport.pro(280)
c:\program files (x86)\visual prolog 9\pfc\odbc\odbcbuffer\odbcbuffer_string_late.pro(36)
c:\program files (x86)\visual prolog 9\pfc\odbc\odbcbuffer\odbcbuffer_string_late.pro(25)
c:\program files (x86)\visual prolog 9\pfc\odbc\odbcbuffer\odbcbuffer_string_late.pro(19)
tableform\tableform.pro(47)
tableform\tableform.pro(24)
c:\program files (x86)\visual prolog 9\pfc\gui\window.pro(1812)
c:\program files (x86)\visual prolog 9\pfc\gui\window.pro(1986)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipKernel.dll (0x14009005)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x15310F18)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x15315FE0)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x15313D95)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531DF76)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531B87A)
C:\WINDOWS\System32\USER32.dll (0x74E8438B)
C:\WINDOWS\System32\USER32.dll (0x74E65EED)
C:\WINDOWS\System32\USER32.dll (0x74E65581)
C:\WINDOWS\System32\USER32.dll (0x74E65498)
C:\WINDOWS\System32\USER32.dll (0x74E8438B)
C:\WINDOWS\System32\USER32.dll (0x74E64F8C)
C:\WINDOWS\System32\USER32.dll (0x74E640DE)
C:\WINDOWS\System32\USER32.dll (0x74E680E1)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531F193)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531ED76)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531EFE5)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531ED95)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531F443)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531F215)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531E20C)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipVpi.dll (0x1531A790)
c:\program files (x86)\visual prolog 9\pfc\vpi\vpi.pro(14)
c:\program files (x86)\visual prolog 9\pfc\windowsapi\exe_api\exe_api.pro(51)
c:\program files (x86)\visual prolog 9\pfc\application\exe\mainexe.pro(36)
c:\program files (x86)\visual prolog 9\pfc\application\exe\mainexe.pro(19)
odbcdemo.pro(13)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipKernel.dll (0x14009174)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\vipKernel.dll (0x140094DD)
D:\My Documents\Documents\Visual Prolog 9 Examples\OdbcDemo\Exe\ODBCdemo.exe (0x00527C17)
C:\WINDOWS\SYSTEM32\ntdll.dll (0x774C7B74)
C:\WINDOWS\SYSTEM32\ntdll.dll (0x774C7B44)
OS: Windows 10.0 Version 1903 (OS Build 18362.592) 64-bit Windows 10 Enterprise

User avatar
Thomas Linder Puls
VIP Member
Posts: 1635
Joined: 28 Feb 2000 0:01

Re: Problem with several SQL datatypes

Unread post by Thomas Linder Puls » 30 Jan 2020 10:32

Many ODBC/SQL configurations requires that "large" fields are last in the query.

So if you write select large_field, small_field from ... you will get such an error.
But if you write select small_field, large_field from ... then you will not get an error.

When you write select * from ... you are asking for the fields in the order corresponding to the create table ... statement that was used to create the table.
Regards Thomas Linder Puls
PDC

Gela Chankvetadze
Posts: 7
Joined: 12 Dec 2006 16:01

Re: Problem with several SQL datatypes

Unread post by Gela Chankvetadze » 30 Jan 2020 11:45

Many Thanks Thomas this help a lot

Post Reply