|
-
Jan 9th, 2004, 07:45 AM
#1
Thread Starter
Junior Member
How to fill one dimensional array from SQL database field
Hi all
I have a table which has numbers field,
and I
declared array (xarray) like
dim xarray as integer()
i get the resultset of my query by this query
Dim SqlCon as new SqlConnection("Data Source=LAPTOP\ALP;User id=Sa;Password=password;Initial Catalog=loto")
Dim SqlCmd as new SqlCommand("Select top 10 no from numbers order by date DESC",SqlCon)
Dim SqlRdr as SqlDataReader
SqlCon.Open()
SqlRdr= SqlCmd.ExecuteReader()
Now I want to fill my array with the result of this query
Is there a way do it with out loop, If no How can I do it with loop
Thank in advance.
-
Jan 9th, 2004, 04:01 PM
#2
Frenzied Member
You just loop through your reader object
using the
do while myReader.Read()
myArray(i) = myReader("CustomerID")
i = i+1
next
//Henrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|