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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:12:45+00:00 2026-05-31T23:12:45+00:00

I have a fairly large SQL statement which has a number of inner joins

  • 0

I have a fairly large SQL statement which has a number of inner joins and cross apply statements to do some calculations which creates new columns for each entry based on the previous query.

I was wondering what the most efficient / best way would be to run this query from C# in code to populate a gridview?

Breaking the SQL up and write some of the calculations in C#?

Creating a stored procedure?

Just passing the sql in as a string and creating a dataset and then binding the dataset to the gridview seems to be taking too long.

  • 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-05-31T23:12:46+00:00Added an answer on May 31, 2026 at 11:12 pm

    Your core problem is that you database query must run faster. Once you have a solution for that, you can adjust your code accordingly.

    The first thing I would look at is to optimize your database indexes to increase your query performance. If you can, use the SQL Profiler and Index Tuning Wizard (I don’t think these tools are available in the Express edition of SQL Server). Please note that new indexes can also cause performance degradation with inserts, so if your database needs to support high transaction volume, you should be careful about using this approach.

    If you can find a way to increase your query performance by breaking down the query into parts and aggregating the results with procedural code, then it would make sense to move to an ObjectDataSource. This will allow you maximum flexibility in how the data is acquired.

    As a starting point, I would prototype your query and/or parts of your query in a SQL editor to that you can focus on just query optimization before you make any decisions about how your ASP.NET code will change.

    I can’t comment further on exactly how to optimize your data extraction without looking at the specifics of your schema and the queries you’re using. But this should get you going in the right direction.

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

Sidebar

Related Questions

I have a Java project which will include a number of large SQL statements
I have compared two queries which fetch some fairly large data from a database
Using a stored procedure i have a fairly complex SQL statement which returns a
We have fairly large C++ application which is composed of about 60 projects in
We have a fairly large SVN repository which we are looking to migrate to
I have a fairly large SQL Server database; I'd like to pull 4 tables
We currently use SQL Server 2005 Enterprise for our fairly large application, that has
I have a large number of images (over 16,000) that are in SQL, that
I have a fairly large application, where my data access strategy has always been
I'm writing a fairly large query, and I have 2 tables, inner joined and

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.