Moving through a Dataset

M

Mark

hi,

i'm trying to cycle through a dataset to test if a row/column in a grid
is the same as in the dataset.

Just wondering if there's an easier way, the recordsets in old ado/asp
seemed much easier to use and datareaders only being forward only is a
pain. Dataset are very complex too.

Code Below:

int i=0;
foreach(DataRow r in dayDS.Tables("Day_Bookings").Rows)
{
int tester = Convert.ToInt32(r["intID"].ToString());
if(tester==row)
{

}
i++;
}


Old style asp:

// begin the cycle to see if there is a booking for this cell
while(!bookings.EOF)
{
if(bookings("room")==roomsarray[col]) //if the room is the same as the
col
{
if(bookings("period") == row) //if the period is the same as the row
{
openCell();
htmlcode+= bookings("staff").value; //print the staff who has the
booking to the cell
closeCell();
printed = true; //a value has been printed for the cell
}

}
bookings.MoveNext(); //move to the next record of bookings
} //end cycle of bookings
 

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

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,118
Latest member
LatishaWhy
Top