Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16369

Re: ADODB and SQL Server rowversion Columns

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.lang.javascript
Subject Re: ADODB and SQL Server rowversion Columns
Date 2012-10-03 16:38 -0700
Organization A noiseless patient Spider
Message-ID <09ip68lr6gp5encecvlhvvive6vuqpekp1@4ax.com> (permalink)
References <397a68lojjat5g9mpdqoqkhivee4j4ia36@4ax.com> <77ha681egee9qftqkobb565omi8066mamq@4ax.com> <ahnb68du225u6agdojkvjgiehje45bmqq6@4ax.com> <2r1n68lhn3oef7o944m8pun17k7dprsse9@4ax.com> <oe5o68damq5fk4pbblknekbicbqv8vmnch@4ax.com>

Show all headers | View raw


On Wed, 03 Oct 2012 20:53:40 +1000, Ross McKay
<au.org.zeta.at.rosko@invalid.invalid> wrote:

>On Tue, 02 Oct 2012 17:37:14 -0700, Gene Wirchenko wrote:

[snip]

>>  2) JavaScript or ADODB or both do not like varchar(max).  JavaScript
>>was displaying the value when I did a document.write of it, but I
>>could not access it with String functions.  Finally, I thought to
>>change what SQL Server returned from varchar(max) to varchar(16), and
>>that did it.
>
>Probably ADODB likes it just fine, but it presents it to JS as a data
>type that doesn't fit into the set of types that JS can handle easily.
>Again, you could mess about with ADO streams to read the binary data and
>return as a string, or... just pick an appropriately sized varchar() to
>cast to as you've done.

     I have done some more experimenting.  I can return a varchar up
to 8000 characters long.  Anything longer requires using varchar(max),
and whenever I do that, boom!

     Oddly enough,
          document.write("<td>"+RS.Fields(i)+"</td>");
works to display a varchar(max).  I have verified that the full string
is displayed (by using Notepad to count).

     But when I try stringising a varchar(max) value and assigning it
to a variable, I get that the length is 4 and the value "null".  Note
that is a string with the four characters "n" et al.  This is
regardless of the length, even short lengths (like 2) do not work.

     I have been unable to access the individual characters in
RS.Fields(i) nor to determine its properties.  The way that I convert
is
          var Work=new String(RS.Fields(i));
With or without the new, it is the same.

     Any other ideas, or do I have to live with the 8000 limit?

[snip]

Sincerely,

Gene Wirchenko

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

ADODB and SQL Server rowversion Columns Gene Wirchenko <genew@ocis.net> - 2012-09-27 21:00 -0700
  Re: ADODB and SQL Server rowversion Columns Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-09-28 16:36 +1000
    Re: ADODB and SQL Server rowversion Columns Gene Wirchenko <genew@ocis.net> - 2012-09-28 10:38 -0700
      Re: ADODB and SQL Server rowversion Columns Gene Wirchenko <genew@ocis.net> - 2012-10-02 17:37 -0700
        Re: ADODB and SQL Server rowversion Columns Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-10-03 20:53 +1000
          Re: ADODB and SQL Server rowversion Columns Gene Wirchenko <genew@ocis.net> - 2012-10-03 16:38 -0700
            Re: ADODB and SQL Server rowversion Columns Ross McKay <au.org.zeta.at.rosko@invalid.invalid> - 2012-10-04 12:02 +1000

csiph-web