Unable to retrieve varchar(max) fields using VB6 ADO on SQL Server with ODBC 13 drivers












1















We have a VB6 application using ADO and needed to update the SQL Server ODBC drivers to handle TLS 1.2 compliancy. I am able to query a varchar(max) field using the original {SQL Server} driver, but any newer ODBC driver will not return varchar(max) fields (13, 11, SQL Native Client 11, 10, etc.). All the other fields field types return fine with newer drivers, except the varchar(max).



I am setting my database connection string as follows:



PROVIDER=MSDASQL;Driver={ODBC Driver 13 for SQL Server};Server=server;DATABASE=dbname;UID=user;PWD=password;DataTypeCompatibility=80;MARS Connection=True;


Then executing the ADO recordset using:



Set recordset1 = gsSQLConn.Execute(strSQL, recordsaffected, adCmdText)


The SQL is



SELECT TABLE.NOTES AS [Value] From TABLE WHERE (((TABLE.NOTES) Is Not Null) AND ((TABLE.TABLE_ID)=#####))


where ##### is a valid integer ID for the table.



The return value shows as:



        2                                                      à                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              


and is type 200 (adVarChar).



I am at a loss on this one, and not sure why I cannot get the newer ODBC drivers to read the varchar(max) fields. I did look into the SQLGetData function, but not quite sure how to get it working for my scenario, or even if it's necessary.










share|improve this question

























  • social.msdn.microsoft.com/Forums/windows/en-US/…?

    – GSerg
    Nov 19 '18 at 23:58











  • Thank you so much! The "garbage characters" nailed it. I was actually able to use SQLOLEDB (a little older) instead of MSOLEDBSQL without any problems. I previously was using MSDASQL to no avail, and even tried other providers (as I came from the DAO world with VB6).

    – Tom
    Nov 20 '18 at 16:38
















1















We have a VB6 application using ADO and needed to update the SQL Server ODBC drivers to handle TLS 1.2 compliancy. I am able to query a varchar(max) field using the original {SQL Server} driver, but any newer ODBC driver will not return varchar(max) fields (13, 11, SQL Native Client 11, 10, etc.). All the other fields field types return fine with newer drivers, except the varchar(max).



I am setting my database connection string as follows:



PROVIDER=MSDASQL;Driver={ODBC Driver 13 for SQL Server};Server=server;DATABASE=dbname;UID=user;PWD=password;DataTypeCompatibility=80;MARS Connection=True;


Then executing the ADO recordset using:



Set recordset1 = gsSQLConn.Execute(strSQL, recordsaffected, adCmdText)


The SQL is



SELECT TABLE.NOTES AS [Value] From TABLE WHERE (((TABLE.NOTES) Is Not Null) AND ((TABLE.TABLE_ID)=#####))


where ##### is a valid integer ID for the table.



The return value shows as:



        2                                                      à                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              


and is type 200 (adVarChar).



I am at a loss on this one, and not sure why I cannot get the newer ODBC drivers to read the varchar(max) fields. I did look into the SQLGetData function, but not quite sure how to get it working for my scenario, or even if it's necessary.










share|improve this question

























  • social.msdn.microsoft.com/Forums/windows/en-US/…?

    – GSerg
    Nov 19 '18 at 23:58











  • Thank you so much! The "garbage characters" nailed it. I was actually able to use SQLOLEDB (a little older) instead of MSOLEDBSQL without any problems. I previously was using MSDASQL to no avail, and even tried other providers (as I came from the DAO world with VB6).

    – Tom
    Nov 20 '18 at 16:38














1












1








1








We have a VB6 application using ADO and needed to update the SQL Server ODBC drivers to handle TLS 1.2 compliancy. I am able to query a varchar(max) field using the original {SQL Server} driver, but any newer ODBC driver will not return varchar(max) fields (13, 11, SQL Native Client 11, 10, etc.). All the other fields field types return fine with newer drivers, except the varchar(max).



I am setting my database connection string as follows:



PROVIDER=MSDASQL;Driver={ODBC Driver 13 for SQL Server};Server=server;DATABASE=dbname;UID=user;PWD=password;DataTypeCompatibility=80;MARS Connection=True;


Then executing the ADO recordset using:



Set recordset1 = gsSQLConn.Execute(strSQL, recordsaffected, adCmdText)


The SQL is



SELECT TABLE.NOTES AS [Value] From TABLE WHERE (((TABLE.NOTES) Is Not Null) AND ((TABLE.TABLE_ID)=#####))


where ##### is a valid integer ID for the table.



The return value shows as:



        2                                                      à                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              


and is type 200 (adVarChar).



I am at a loss on this one, and not sure why I cannot get the newer ODBC drivers to read the varchar(max) fields. I did look into the SQLGetData function, but not quite sure how to get it working for my scenario, or even if it's necessary.










share|improve this question
















We have a VB6 application using ADO and needed to update the SQL Server ODBC drivers to handle TLS 1.2 compliancy. I am able to query a varchar(max) field using the original {SQL Server} driver, but any newer ODBC driver will not return varchar(max) fields (13, 11, SQL Native Client 11, 10, etc.). All the other fields field types return fine with newer drivers, except the varchar(max).



I am setting my database connection string as follows:



PROVIDER=MSDASQL;Driver={ODBC Driver 13 for SQL Server};Server=server;DATABASE=dbname;UID=user;PWD=password;DataTypeCompatibility=80;MARS Connection=True;


Then executing the ADO recordset using:



Set recordset1 = gsSQLConn.Execute(strSQL, recordsaffected, adCmdText)


The SQL is



SELECT TABLE.NOTES AS [Value] From TABLE WHERE (((TABLE.NOTES) Is Not Null) AND ((TABLE.TABLE_ID)=#####))


where ##### is a valid integer ID for the table.



The return value shows as:



        2                                                      à                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              


and is type 200 (adVarChar).



I am at a loss on this one, and not sure why I cannot get the newer ODBC drivers to read the varchar(max) fields. I did look into the SQLGetData function, but not quite sure how to get it working for my scenario, or even if it's necessary.







sql-server vb6 odbc ado






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 23:43









Sami

8,29231240




8,29231240










asked Nov 19 '18 at 23:41









TomTom

62




62













  • social.msdn.microsoft.com/Forums/windows/en-US/…?

    – GSerg
    Nov 19 '18 at 23:58











  • Thank you so much! The "garbage characters" nailed it. I was actually able to use SQLOLEDB (a little older) instead of MSOLEDBSQL without any problems. I previously was using MSDASQL to no avail, and even tried other providers (as I came from the DAO world with VB6).

    – Tom
    Nov 20 '18 at 16:38



















  • social.msdn.microsoft.com/Forums/windows/en-US/…?

    – GSerg
    Nov 19 '18 at 23:58











  • Thank you so much! The "garbage characters" nailed it. I was actually able to use SQLOLEDB (a little older) instead of MSOLEDBSQL without any problems. I previously was using MSDASQL to no avail, and even tried other providers (as I came from the DAO world with VB6).

    – Tom
    Nov 20 '18 at 16:38

















social.msdn.microsoft.com/Forums/windows/en-US/…?

– GSerg
Nov 19 '18 at 23:58





social.msdn.microsoft.com/Forums/windows/en-US/…?

– GSerg
Nov 19 '18 at 23:58













Thank you so much! The "garbage characters" nailed it. I was actually able to use SQLOLEDB (a little older) instead of MSOLEDBSQL without any problems. I previously was using MSDASQL to no avail, and even tried other providers (as I came from the DAO world with VB6).

– Tom
Nov 20 '18 at 16:38





Thank you so much! The "garbage characters" nailed it. I was actually able to use SQLOLEDB (a little older) instead of MSOLEDBSQL without any problems. I previously was using MSDASQL to no avail, and even tried other providers (as I came from the DAO world with VB6).

– Tom
Nov 20 '18 at 16:38












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384227%2funable-to-retrieve-varcharmax-fields-using-vb6-ado-on-sql-server-with-odbc-13%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53384227%2funable-to-retrieve-varcharmax-fields-using-vb6-ado-on-sql-server-with-odbc-13%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

Npm cannot find a required file even through it is in the searched directory