Reading into a rectangular array

  • Thread starter Thread starter almurph
  • Start date Start date
A

almurph

Hi everyone,

I have a "SqlDataReader" that I know has 2 columns in it with around
361 rows of data like:

columnA columnB

value1 value3
value1 value4

I am trying to read this into a rectangular string array called
myArray()(). The problem is I don't know how!!

Can anyone help me please? Any suggestions/comments/ideas/code-samples
greatly welcomed.

Thank you,
Al.
 
Hi everyone,

I have a "SqlDataReader" that I know has 2 columns in it with around
361 rows of data like:

columnA columnB

value1 value3
value1 value4

I am trying to read this into a rectangular string array called
myArray()(). The problem is I don't know how!!

Can anyone help me please? Any suggestions/comments/ideas/code-samples
greatly welcomed.

Thank you,
Al.

Why not use a DataTable. It is basically the same array. There are a
thousand examples about this if you do a google search.

But for what you asked:

Pseudo code:

Do while MyDataReader.Read
MyStringArray(RowCount)(0) = MyDataReader.GetString(0)
MyStringArray(RowCount)(1) = MyDataReader.GetString(1)
Loop

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top