المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Looping through Dataset instead of DataGridView?



C# Programming
03-11-2010, 03:22 AM
Hi,

I would like to loop through the DataSet at runtime to retrieve selected values and store them in local variables but i am not sure how i could do this using DataSet that is generated using the inbuilt wizard. I am using SQL Server Compact. My database has "*.sdf" extension. I created a strongly typed DataSet using the wizard. So in the solution explorer i can see the DataSet and it has an extension of "*.xsd".

At the moment i am doing this:

foreach(DataGridViewRow dgvrow in CustomerGridView.Rows)
{
//e.g to get surname
String Surname = dgvrow.Cells[2].Value.ToString();
//do some other stuff here too
}

Wouldnt it be more efficient if i looped through the DataSet that I have created? If so, how would i go about doing this based on the above code.

If anybody could assist me with this, it would be much appreciated.

Thanks,