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 8888849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:07:15+00:00 2026-06-14T22:07:15+00:00

Hi I am getting the data from Sql Server like for about 1000 stores.

  • 0

Hi I am getting the data from Sql Server like

enter image description here

for about 1000 stores.

I need to put data in to excel file like as

enter image description here

and so on until now i have managed to code like as console application

if (reader.HasRows) {
    while (reader.Read()) {
        SqlDataAdapter da = new SqlDataAdapter("StoresWithProduct", connection);
        da.SelectCommand.CommandType = CommandType.StoredProcedure;
        da.SelectCommand.Parameters.AddWithValue("@StoreID", reader.GetInt32(0));
        DataSet ds = new DataSet();
        da.Fill(ds, "table1");
        foreach (DataRow dr1 in ds.Tables["table1"].Rows) {
            Console.Write("Store Code:" + dr1["StoreCode"] + "\t");
            foreach (DataRow dr in ds.Tables["table1"].Rows)
            {
                Console.Write(dr["itemNumber"]+"-" + dr["quantity"]+"\t\n");
            }
            break;
        }
    }
} else {
    Console.WriteLine("No rows found.");
}
Console.ReadLine();
reader.Close();
connection.Close();

but not able to put into the excel file the way i want, any pointer will be appriciated.

Thanks

  • 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-14T22:07:16+00:00Added an answer on June 14, 2026 at 10:07 pm

    I would recommend looking at EPPlus

    We’ve used this library extensively for generating complex Excel workbooks including pivot tables. Usage is very straightforward with plenty of examples and help on codeplex site.

    I hope this helps!

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

Sidebar

Related Questions

Getting error while inserting values into database (SQL Server 2008) Implicit conversion from data
My colleague asked me a question regarding getting data from a SQL Server database.
I created SSIS will do task like get data from oracle to sql server.i
Im getting data from a server by executing this code: - (void) sendGeneral:(NSString *)
I am getting data from server it gives in response a NSString which hase
I need to automate a process that involves getting data from a series of
I have a custom list view that is getting data from server and changing
I'm simply trying to get data from two sql server db tables using ado.net
I have an MS SQL Server 2008 Database, from which I am fetching data
I'm getting data out of a SQL-Server nvarchar(3000) field, which is formatted as html,

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.