0
Answer

Reading datarows

Jayson

Jayson

16y
1.9k
1
I have a data table that I'm reading from and I want to read two rows at a time.  I'm trying to write the data from each row into a string and then append it.  I  need to put the data into two image blocks.  Is there some kind of MoveNext value?  Any help would be appreciated. Here's a code block example of what I'm trying to do.

Something like:

 foreach (DataRow dr in dt.Rows)
{
    string pageBlock = RawHTML.pageBlock();
// read in data for first image block
// imageDataBlock1
                        pageBlock = pageBlock.Replace("[@imageDataBlock1]", RawHTML.imageDataBlock(dr["OrderID"].ToString(), dr["DistID"].ToString(), dr["userid"].ToString(), dr["orderdate"].ToString(), dr["phone"].ToString(), string.Empty, dr["warehouse"].ToString(), dr["shipmethod"].ToString(), dr["weight"].ToString(), string.Empty));
**// here is where i want to move to the next row and read in data for second image block
 //image data block 2                    
pageBlock = pageBlock.Replace("[@imageDataBlock2]", RawHTML.imageDataBlock(dr["OrderID"].ToString(), dr["DistID"].ToString(), dr["userid"].ToString(), dr["orderdate"].ToString(), dr["phone"].ToString(), string.Empty, dr["warehouse"].ToString(), dr["shipmethod"].ToString(), dr["weight"].ToString(), string.Empty));

sb.Append(pageBlock);

}