C# Corner Annual Conference 2015
Forum guidelines
AuthorQuestion
how to specify row in datatable
Posted By ahmed fahd on 05 Jan 2013
how to specify row in datatable and move between datatable rows
and can i give this row to datareader?

I'm some one who want to learn every where. Know that I can't know every thing but any way i want to add new thing for you.
AuthorReply
Re: how to specify row in datatable
Posted By Jignesh Trivedi on 06 Jan 2013  
hi,

DataReader object provides a read only, forward only, high performance mechanism to retrieve data from a data store, so i think you cannot move data from datatable to datareader.

to move datarow form one table to other table

var logEntries = new DataTable()
//Fill logEntries data table
...
...

// Move Row from logEntries to datatable.

var dataTable = new DataTable();
dataTable.Columns.Add("EntryType");
dataTable.Columns.Add("TimeGenerated");
dataTable.Columns.Add("Message");
dataTable.Columns.Add("Category");
for (int loop = logEntries.Count - 1; loop >= 0; loop--)
{
    var row = new[]
    {
        logEntries[loop].EntryType.ToString(),
        logEntries[loop].TimeGenerated.ToString(),
        logEntries[loop].Message,
        logEntries[loop].Category
    };
    dataTable.Rows.Add(row);
}



please refer
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q308909

hope this will help you.

C# Corner Annual Conference 2015

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.