Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8730187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:58:05+00:00 2026-06-13T08:58:05+00:00

I have a software system that I am ‘trying’ to maintain and upgrade. I

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:58:06+00:00Added an answer on June 13, 2026 at 8:58 am

    Certainly a few ways to do this, but something like this should work:

            DataSet dsMain = GetMyMainDataSet();
            DataSet dsTablesById = new DataSet();
    
            foreach (DataRow row in dsMain.Tables[0].Rows)
            {
                string storeId = row["storeid"].ToString();
                if (!dsTablesById.Tables.Contains(storeId))
                {
                    dsTablesById.Tables.Add(storeId);
                    foreach (DataColumn col in dsMain.Tables[0].Columns)
                    {
                        dsTablesById.Tables[storeId].Columns.Add(col.ColumnName, col.DataType);
                    }
                }
                dsTablesById.Tables[storeId].Rows.Add(row.ItemArray);
                dsTablesById.Tables[storeId].AcceptChanges();
            }
    

    dsTablesById would contain all of your datatables, each named by your distinct values of storeid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have some software written in VB6.0 that uses an SQL Server, but
We have a large SQL driven software system which has been around since Delphi
We have an embedded device that needs to interact with an enterprise software system.
I have a software system that performs OCR on Multiple machine simultaneously. Current system
We have software that runs fine under a normal Windows installation but when we
I have a software that is tracking an NTFS volume changes on a Windows
We have this software that has a webservices component. Now, the administrator of this
I have a software that runs on mac (using terminal program) the program is
I have a software renderer that I am porting from PC to the iPhone.
I have some software written in VB.NET that performs a lot of calculations, mostly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.