04-29-2015 08:27 AM - edited 04-29-2015 08:31 AM
Using LV2013.
in ADODB, 'adLongVarChar' is the datatype for "TEXT" and 'adLongVarBinary' is the datatype for "BLOB".
NI_Database_API does not implement them, in the VI "vi.lib\addons\database\Auxilliary.llb\DB Tools Type and Dir to ADO.vi" it is always 'adVarChar' and 'adBinary'. This is wrong.
For some DBMS this might not be a problem, but for SQL Server this is a big problem.
If you don't specify its an adLongVarChar, SQL Server right truncate data to 8000 bytes, indeed it gives an error and drop the changes.
This error seems to be ignored due old versions of SQL Server used to support only up to 8000 bytes in a row column, but now if you specify VARBINARY(MAX) - you will need to use adLongVarBinary to use the 2TB MAX of space, or if you use TEXT (which is an alias to VARCHAR(MAX)) you will need to use adLongVarChar to use the 2TB MAX of space in row column.
I've made fixes in the NI_Database_API by myself for it to work. I feel like NI_Database_API is abandoned.
I usually don't use this API, only when I need ODBC connectivity, usually I use SQLlite for my applications.
I've found out the problem by reading this http://stackoverflow.com/questions/1074428/how-to-write-to-a-varcharmax-column-using-odbc
Attached the fix done, now inserts of long text and blobs working.
04-29-2015 08:41 AM
Report it as a bug and see what happens.
04-29-2015 08:49 AM
Following your suggestion, aputman, made a service request ( #7446915 ).
But it is intersting to be here in forum, as other might issue this error. I've lost about a day to find this problem.
07-08-2015 05:36 AM
Thank you!
Just came to same conclusion independently but to put some more weight behind I just had this issue. This makes the toolkit incompatible with the new (well since 2005) sql server nvarbinary(max) times.
Cheers,
James