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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:32:23+00:00 2026-06-06T02:32:23+00:00

i am using the crystal report in c# web application. there is a problem

  • 0

i am using the crystal report in c# web application. there is a problem that the crystal report load last record from For loop.

i stores the code of product in for loop as code. and according to that single or multiple code the the crystal report shows info. of that product.

i use….

for (int i = 0; i < code.Length; i++)
    {
        string str = "select crbal*-1 as crbal, glname, contprsn, refby, glphone1, glcity, glphone2, email, crlimit, restorddueamt  from db1.dbo.glmast WHERE drgroup='A3402' and crbal<>0 and glcode="+code[i]+ "";

        SqlDataAdapter ad = new SqlDataAdapter(str, con2);
        DataSet ds = new DataSet();
        ad.Fill(ds);

        path = Server.MapPath("ERP_REPORT_MAIN.rpt");
        cr = new ReportDocument();
        cr.Load(path);

        cr.SetDataSource(ds.Tables[0]);
        CrystalReportViewer1.ReportSource = cr;
    }

if, there is two code in for loop it display last record only. please Help Me.

Thanks and Regards…
Mitesh

  • 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-06T02:32:25+00:00Added an answer on June 6, 2026 at 2:32 am

    I would revise the code, and make also some slight efficiency improvments:

    string query = "select crbal*-1 as crbal, glname, contprsn, refby, glphone1, glcity,    glphone2, email, crlimit, restorddueamt  from db1.dbo.glmast WHERE drgroup='A3402' and crbal<>0 and glcode in (
    
    for (int i = 0; i < code.Length; i++)
    {
        query += code[i];
        if (i != code.Length -1)
            query += ","
        else
            query += ")";
    }
    
    SqlDataAdapter ad = new SqlDataAdapter(str, con2);
    DataSet ds = new DataSet();
    ad.Fill(ds);
    
    path = Server.MapPath("ERP_REPORT_MAIN.rpt");
    cr = new ReportDocument();
    cr.Load(path);
    
    cr.SetDataSource(ds.Tables[0]);
    CrystalReportViewer1.ReportSource = cr;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Crystal Report used in an ASP.NET web application that I've just
I am using the crystal report, in that i am using code like below
I am doing a web application in .net with crystal report, is there a
I am using Visual Studio, .NET to create a web application that uses Crystal
Using Crystal Report 8.5 Generating a report from table1 My Crystal Report Output ID
I'm using Crystal Report with VB.NET in Visual Studio 2005. I have report that
I have a web application that has a report. I export this report as
I made a report using crystal report and in the page load I am
I have built a web page which contains a Crystal Report built using the
I have a crystal report in my asp.net web application which has a lot

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.