For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > March 2006 > Making a 1-d array from a 2-d array, easy way?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Making a 1-d array from a 2-d array, easy way?
Maury Markowitz

2006-03-29, 6:56 pm

ADODB's GetRows method always returns a 2-d array, even if there is only one
element (column). I need to turn this (0 to 0, 0 to 13) resulting array into
a (0 to 13) array. I can't find anything like this in the dox, is there some
simple syntax for this?

Maury
RB Smissaert

2006-03-29, 6:56 pm

I think there is no other way then just looping through the 2 arrays.
This is quite fast and simple in any case.

RBS

"Maury Markowitz" <MauryMarkowitz@discussions.microsoft.com> wrote in
message news:19E5E327-8A2A-4AB2-B214-703A598B3F4D@microsoft.com...
> ADODB's GetRows method always returns a 2-d array, even if there is only
> one
> element (column). I need to turn this (0 to 0, 0 to 13) resulting array
> into
> a (0 to 13) array. I can't find anything like this in the dox, is there
> some
> simple syntax for this?
>
> Maury


Clinton

2006-03-30, 3:55 am

Use the ADO GetString method instead.
Then use the VB Split() function on it.

Something like this:
Dim ary() As String
ary=split(ro.GetString,vbcr)

or,

ary = Split(rsADO.GetString(RowDelimeter:="||"), Delimiter:="||")

Notes:
Using two pipes in order to reduce possible errors caused by other printible
and non printable characters(such as CR, LF) which are already in the in the
record field text.

Typo:
There is a difference in the spelling of the "Delimiter" named arguments
"RowDelimEter" and "DelimIter"

"Maury Markowitz" wrote:

> ADODB's GetRows method always returns a 2-d array, even if there is only one
> element (column). I need to turn this (0 to 0, 0 to 13) resulting array into
> a (0 to 13) array. I can't find anything like this in the dox, is there some
> simple syntax for this?
>
> Maury

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com