I have a datatable with about 15000 rows that i need to break down in 9999 rows and get the items and do stuff with them and the get next 9999 until all is processed
This is the getdata code
public DataTable GetData()
{
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["sqlconnection1"].ConnectionString);
conn.Open();
string query = "SELECT [number],[surname],[forename],[emailAddress],[taxIdentifier] FROM[Customer] WITH(NOLOCK) WHERE[CustomerID] IN(SELECT[CustomerID] FROM[Visit] WITH(NOLOCK) WHERE[GamingDate] Between convert(Date, DATEADD(DAY, -365, GETDATE())) AND convert(Date, getdate())) AND(EmailAddress IS NOT NULL) AND(ContactTypes & 1 = 1) AND(HomePropertyID = '2') /* 2= Malmö 3=Göteborg 4=Stockholm */ AND(LEN(TaxIdentifier) = '12')";
SqlCommand cmd = new SqlCommand(query, conn);
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader());
conn.Close();
return dt;
}
Then i dont have anymore code to handle the data Every row has number,surname,forename,email,tax that i need to use
My question is: How do i get 9999 rows from the datatable? How do i get next 9999 rows until all rows are being processed?
Hope you understand my need and can help me
Thanks