I want to select many rows from my SQL Server database and combine them in a certain manner. Currently, I've been using the following method to get these rows:
SqlDataSource mySource = new SqlDataSource("ConnectionString","SelectStatement");
IEnumerable myEnum = mySource.Select(DataSourceSelectArguments.Empty);
IEnumerator myCount = myEnum.GetEnumerator();
while(myCount.MoveNext()) //Iterate through each row
{
DataRowView myView = (DataRowView)myCount.Current; //This is the current row
//Do something with this row
}
I feel like there must be a better way of doing this. Any suggestions?