By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,557 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,557 IT Pros & Developers. It's quick & easy.

DataTable Reading.....

P: n/a
What is the syntax to read the data from a DataTable by row # and (column #
or name)?

..Net Framework 1.1 and VB.Net.

I have the below code from documentation

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For Each myCol In thisTable.Columns
Console.WriteLine(myRow(myCol))
Next myCol
Next myRow
Next thisTable

But I wanted read the datatable data by referencing as above specified.

Thank you,

-Pete
Feb 14 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Pete Smith wrote:
What is the syntax to read the data from a DataTable by row # and (column #
or name)?

.Net Framework 1.1 and VB.Net.

I have the below code from documentation

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For Each myCol In thisTable.Columns
Console.WriteLine(myRow(myCol))
Next myCol
Next myRow
Next thisTable

But I wanted read the datatable data by referencing as above specified.

Thank you,

-Pete


For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For ii as integer = 0 to thisTable.Columns -1
Console.WriteLine(myRow(ii))
Next myCol
Next myRow
Next thisTable
Feb 14 '06 #2

P: n/a
Chris wrote:
Pete Smith wrote:
What is the syntax to read the data from a DataTable by row # and
(column #
or name)?

.Net Framework 1.1 and VB.Net.

I have the below code from documentation

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For Each myCol In thisTable.Columns
Console.WriteLine(myRow(myCol))
Next myCol
Next myRow
Next thisTable

But I wanted read the datatable data by referencing as above specified.

Thank you,

-Pete


For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For ii as integer = 0 to thisTable.Columns -1
Console.WriteLine(myRow(ii))
Next myCol
Next myRow
Next thisTable

Oh, and your way doesn't work because a MyRow object does not contain a
DataColumn. Only the datatable contains a column object.

Chris
Feb 14 '06 #3

P: n/a
Thank you for the reply. But it did not answer my question fully.
-Pete
"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Chris wrote:
Pete Smith wrote:
What is the syntax to read the data from a DataTable by row # and
(column #
or name)?

.Net Framework 1.1 and VB.Net.

I have the below code from documentation

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For Each myCol In thisTable.Columns
Console.WriteLine(myRow(myCol))
Next myCol
Next myRow
Next thisTable

But I wanted read the datatable data by referencing as above specified.

Thank you,

-Pete


For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For ii as integer = 0 to thisTable.Columns -1
Console.WriteLine(myRow(ii))
Next myCol
Next myRow
Next thisTable

Oh, and your way doesn't work because a MyRow object does not contain a
DataColumn. Only the datatable contains a column object.

Chris

Feb 14 '06 #4

P: n/a
Pete Smith wrote:
Thank you for the reply. But it did not answer my question fully.
-Pete
"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Chris wrote:
Pete Smith wrote:
What is the syntax to read the data from a DataTable by row # and
(column #
or name)?

.Net Framework 1.1 and VB.Net.

I have the below code from documentation

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For Each myCol In thisTable.Columns
Console.WriteLine(myRow(myCol))
Next myCol
Next myRow
Next thisTable

But I wanted read the datatable data by referencing as above specified.

Thank you,

-Pete

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For ii as integer = 0 to thisTable.Columns -1
Console.WriteLine(myRow(ii))
Next myCol
Next myRow
Next thisTable

Oh, and your way doesn't work because a MyRow object does not contain a
DataColumn. Only the datatable contains a column object.

Chris


What wasn't answered?
Feb 14 '06 #5

P: n/a
Is there anyway I can read cell(x,y) in the DataTable?
Thank you,
-Pete

"Chris" <no@spam.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Pete Smith wrote:
Thank you for the reply. But it did not answer my question fully.
-Pete
"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Chris wrote:

Pete Smith wrote:
>What is the syntax to read the data from a DataTable by row # and
>(column #
>or name)?
>
>.Net Framework 1.1 and VB.Net.
>
>I have the below code from documentation
>
>
>
>For Each thisTable In myDataSet.Tables
> ' For each row, print the values of each column.
> Dim myRow As DataRow
> For Each myRow In thisTable.Rows
> Dim myCol As DataColumn
> For Each myCol In thisTable.Columns
> Console.WriteLine(myRow(myCol))
> Next myCol
> Next myRow
> Next thisTable
>
>But I wanted read the datatable data by referencing as above specified.>
>
>
>Thank you,
>
>-Pete
>
>

For Each thisTable In myDataSet.Tables
' For each row, print the values of each column.
Dim myRow As DataRow
For Each myRow In thisTable.Rows
Dim myCol As DataColumn
For ii as integer = 0 to thisTable.Columns -1
Console.WriteLine(myRow(ii))
Next myCol
Next myRow
Next thisTable
Oh, and your way doesn't work because a MyRow object does not contain a
DataColumn. Only the datatable contains a column object.

Chris


What wasn't answered?

Feb 14 '06 #6

P: n/a
Pete Smith wrote:
Is there anyway I can read cell(x,y) in the DataTable?
Thank you,
-Pete

"Chris" <no@spam.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Pete Smith wrote:
Thank you for the reply. But it did not answer my question fully.
-Pete
"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl. ..
Chris wrote:
>Pete Smith wrote:
>
>
>
>>What is the syntax to read the data from a DataTable by row # and
>>(column #
>>or name)?
>>
>>.Net Framework 1.1 and VB.Net.
>>
>>I have the below code from documentation
>>
>>
>>
>>For Each thisTable In myDataSet.Tables
>> ' For each row, print the values of each column.
>> Dim myRow As DataRow
>> For Each myRow In thisTable.Rows
>> Dim myCol As DataColumn
>> For Each myCol In thisTable.Columns
>> Console.WriteLine(myRow(myCol))
>> Next myCol
>> Next myRow
>> Next thisTable
>>
>>But I wanted read the datatable data by referencing as above
specified.

>>
>>Thank you,
>>
>>-Pete
>>
>>
>
>For Each thisTable In myDataSet.Tables
>' For each row, print the values of each column.
> Dim myRow As DataRow
> For Each myRow In thisTable.Rows
> Dim myCol As DataColumn
> For ii as integer = 0 to thisTable.Columns -1
> Console.WriteLine(myRow(ii))
> Next myCol
> Next myRow
>Next thisTable
Oh, and your way doesn't work because a MyRow object does not contain a
DataColumn. Only the datatable contains a column object.

Chris

What wasn't answered?



My example just showed you how to read every cell in the datatable.

To be more exact:
myDataSet.Tables(Z).Rows(Y).Item(X)

Chris
Feb 14 '06 #7

P: n/a
Thank you,
-Pete

"Chris" <no@spam.com> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
Pete Smith wrote:
Is there anyway I can read cell(x,y) in the DataTable?
Thank you,
-Pete

"Chris" <no@spam.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Pete Smith wrote:

Thank you for the reply. But it did not answer my question fully.
-Pete
"Chris" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl. ..
>Chris wrote:
>
>
>>Pete Smith wrote:
>>
>>
>>
>>>What is the syntax to read the data from a DataTable by row # and
>>>(column #
>>>or name)?
>>>
>>>.Net Framework 1.1 and VB.Net.
>>>
>>>I have the below code from documentation
>>>
>>>
>>>
>>>For Each thisTable In myDataSet.Tables
>>> ' For each row, print the values of each column.
>>> Dim myRow As DataRow
>>> For Each myRow In thisTable.Rows
>>> Dim myCol As DataColumn
>>> For Each myCol In thisTable.Columns
>>> Console.WriteLine(myRow(myCol))
>>> Next myCol
>>> Next myRow
>>> Next thisTable
>>>
>>>But I wanted read the datatable data by referencing as above


specified.
>>>
>>>
>>>Thank you,
>>>
>>>-Pete
>>>
>>>
>>
>>For Each thisTable In myDataSet.Tables
>>' For each row, print the values of each column.
>> Dim myRow As DataRow
>> For Each myRow In thisTable.Rows
>> Dim myCol As DataColumn
>> For ii as integer = 0 to thisTable.Columns -1
>> Console.WriteLine(myRow(ii))
>> Next myCol
>> Next myRow
>>Next thisTable
>
>
>Oh, and your way doesn't work because a MyRow object does not contain a>DataColumn. Only the datatable contains a column object.
>
>Chris

What wasn't answered?



My example just showed you how to read every cell in the datatable.

To be more exact:
myDataSet.Tables(Z).Rows(Y).Item(X)

Chris

Feb 14 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.