DataTable in a DataSet

G

Guest

Hello all
foreach(DataTable myTable in m_DsConfig.Tables)
{
if(myTable.TableName == "DataSourceCodeView")
{
len = myTable.Rows.Count;
}
}
I am trying to get the number of rows in a datatable that
is contained by a dataset. I am always getting a value of
zero for the number of rows and I know that is not correct.
Can you help me with using the correct property or method?

I am trying to get a valid count from the following piece
of code also. But no success so far.

foreach(DataTable myTable in m_DsConfig.Tables)
{
if(myTable.TableName == "DataSourceCodeView")
{
DataRow[] Rows = myTable.Select("Parameter
= 'MyTestParam'");
int len = Rows.Length;
}
}

Thanks a lot for your help.
 
G

Guest

The code looks correct. Are you sure there are tables in there to start with

foreach(DataTable myTable in m_DsConfig.Tables

if(myTable.TableName == "DataSourceCodeView"

Console.WriteLine(myTable.ToString()); // Do some testin
len = myTable.Rows.Count
 

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

Top