| |
Sign In
This might sound really obvious, but i couldn't find a better way. Normally i would use TOP in the SQL query to limit the number of records i want to retrieve, but in my case, this value is parameterised and Access won't allow me to parameterise that value. I tried using a DataView but TOP isn't one of it's supported functions. So i just loop through the dataset and keep removing rows until the right number of records is reached.
int maxItems = 5; while(ds.Tables[0].Rows.Count > MaxItems) ds.Tables[0].Rows.RemoveAt(MaxItems);
Remember Me