Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to redim array return from getrows method

Status
Not open for further replies.

andypower

Programmer
Aug 10, 2004
23
IN
hello myself avi
i am working in vb 6 and using ado library
i have some problem regarding array redimension.
i used array which is return from ado's getrows method.
it is 2 dimensional array.
my first query returns me total 76 records i.e my array ubound=76 and i want to add second queries record in same array. for that i used redim preserve but it wont work.array shows only those records that are return from second query
here is my sample code

Strsql = ""
Strsql = "Select distinct(garanter1) From LoanDetails"
RsMember.Open Strsql, Conn, adOpenKeyset
ArrGurName = RsMember.GetRows()
RsMember.Close



Strsql = ""
Strsql = "Select distinct(garanter2) From LoanDetails where garanter2 not in (select garanter1 from loandetails)"
RsMember.Open Strsql, Conn, adOpenKeyset
ReDim Preserve ArrGurName(0, UBound(ArrGurName, 2) + RsMember.RecordCount)
ArrGurName = RsMember.GetRows()

plz i required it very urgent and i dont wana use any looping to do this because my data size is very large
thanks in advance
 
You can't do it the way you show, as the second getrows call will overwrite the array contents. You can use a union in your sql statement so you can get everything in one statement (as long as the data types you are returning are the same):

Code:
Select distinct(garanter1) From LoanDetails
union
Select distinct(garanter2) From LoanDetails where garanter2 not in (select garanter1 from loandetails)

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top