ADODB record set from SQL Server 2008 garbles some fields when read in Excel VBA in Windows XP, but not Windows 7

  • 1. Source of recordset SQL Server stored procedure.

    2. Means of access: ADODB recordset in Excel VBA, using adOpenForwardOnly

    3. Referenced library in VBA: Microsoft ActiveX Data Objects 2.8 Library

    4. All fields turn up in the expected text format when I run the stored procedure right on the SQL server management studio.

    4. In Windows 7, all fields are delivered as they should.

    5. In Windows XP, two of the text fields (not too long, under 200 characters) become garbled.

    By "garbled" I mean turn up with octet values in the range 0 to 31 (i.e., less than a space) with a few,

    scattered in the field, of higher values.

    Any ideas? I'm stumped!

  • I'll go ahead and talk with myself here, relieved that I found an answer. When the SQL Server delivers a field typed varchar(max), that field turns into trash upon ADODB delivery to SQL Server 2008 (maybe other versions as well but this one for sure). To avoid the problem, don''t use varchar(max) as a type for any field.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply