I have a software system that I am ‘trying’ to maintain and upgrade. I have had no formal c# training and only 1 class of sql. Most of my limited experience is with Java, C++. We are using MSSQL 2005.
I have a query run in c# that gets a dataset with 1 table and 15 or so columns. The number of rows returned is different each time it is ran. The first column is the storeid. I need to separate records by storeid in to their own datatable. Once I have that there is an existing method for sending it out to a CSV file.
So far I have found Datatable.Select, order it by storeid.
One option would be pulling all the unique storeid’s from the dataset and putting them into an array. Then I could query based on existing storeid’s and copy or move those rows to a new datatable using a foreach.
If someone could just point me in the right direction it would be much appreciated.
Mark
Certainly a few ways to do this, but something like this should work:
dsTablesById would contain all of your datatables, each named by your distinct values of storeid.