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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:19:14+00:00 2026-06-02T08:19:14+00:00

Good Afternoon Developers, This is my function to generate the crystal Report,This will take

  • 0

Good Afternoon Developers,
This is my function to generate the crystal Report,This will take the Report Name and ReportQuery as a input parameter and will generate a dataset , With this dataset how can i design my Report??Because this is Generated at the runtime , How can i access that to generate my ReportDesign??

public void fnLoadDataToReport(string rptName, string rptQuery)
{
    try
    {
        DataSet myDS=new DataSet();
//      crReportDocument.Load(Server.MapPath("Reports\" & RptName), OpenReportMethod.OpenReportByTempCopy);
        crReportDocument.Load(Server.MapPath("Reports\\" + rptName ));
        SqlConnection myConnection=new SqlConnection(ConfigurationManager.ConnectionStrings["mycon"].ConnectionString);
        SqlCommand myCommand=new SqlCommand(rptQuery,myConnection);
        SqlDataAdapter MyDA=new SqlDataAdapter(myCommand);
        MyDA.Fill(myDS,"ReportTable");
        crReportDocument.SetDataSource(myDS);
        crvReportGeneration.ReportSource=crReportDocument;
        crvReportGeneration.ShowFirstPage();
    }
    catch(Exception ex)
    {
        Response.Write(ex.Message);
    }
}

Any help is appreciable….!

  • 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-02T08:19:17+00:00Added an answer on June 2, 2026 at 8:19 am

    All you need is an XML schema definition of the Dataset to be able to design the report. this can be achieved by the following code.

    private void WriteSchemaToFile(DataSet thisDataSet){
       // Set the file path and name. Modify this for your purposes.
       string filename="mySchema.xml";
       // Write the schema to the file.
       thisDataSet.WriteXmlSchema(filename);
    }
    

    now add the above created file to your project.

    Now while designing the report select Database expert and select the xml file under Project. and add it (just like you add tables or views).

    Now you are good to go. The rest of the steps are same.

    Just make sure the name of the XSD schema and the table name in your Dataset match exactly.

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

Sidebar

Related Questions

Good afternoon all, I am building a function that takes a string as input,
Good afternoon to all, I have this scenario: I am using SQL Server 'BulkInsert'
Good afternoon I have a table that has customer id, name, computer, laptop, blah,
Good afternoon all, I have a class which looks like this: public class Grapheme
Good afternoon all, I was taught that when a function returns, The variables (within
Dear Friends good afternoon. My problem may be this is very basic one i.e.
Good Afternoon Developer, this is my content in asp .net, I want the user
Good afternoon, I have a doubt. I have a div with two input button
Good Afternoon, I've written a very basic stored procedure that will be used to
Good afternoon, I wish to have a script that will look for all files

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.