473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataTable Reading.....

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
7 38129
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: DraguVaso | last post by:
Hi, I need a FAST way to put the content of a file in a datatable (one record for each line in the file). I have a routine for it, but it takes me too much time (2-5 seconds for each file) to...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
1
by: hzgt9b | last post by:
(FYI, using VB .NET 2003) Can someone help me with this... I'm trying to read in an XML file... it appears to work in that the DataSet ReadXML method dose not fail and then I am able to access the...
4
by: Amit Maheshwari | last post by:
I need to read text file having data either comma seperated or tab seperated or any custom seperator and convert into a DataSet in C# . I tried Microsoft Text Driver and Microsoft.Jet.OLEDB.4.0...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
6
by: AlveenX | last post by:
Hi, I am trying to pick a Guid from a data row using the following code: foreach(DataRow row in MyDataTable.Rows) { (Guid)row }
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
0
by: Anish G | last post by:
Hi, I have an issue with reading CSV files. I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.