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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:10:15+00:00 2026-05-16T04:10:15+00:00

Since there doesn’t seem to be any way to load old VB6 (ActiveReports) reports

  • 0

Since there doesn’t seem to be any way to load old VB6 (ActiveReports) reports in .Net, I need to recreate dozens of reports in .Net. I’d like to do this in the least painful way possible.

In VB6, the original authors simply did something like this for every report:

adoConn.ConnectionString = globalConnectionObject.ConnectionString
adoConn.Source = ReportFunctions.GetAllUsers()

GetAllUsers() returns an SQL string which selects a bunch of fields; those fields are then used in the report.

Now:
How can I do something similar in .Net (either using the built-in Crystal Reports, or the built-in “Microsoft Reporting Technology”)?

I can’t get “Database Expert” to recognize globalConnectionObject (an ADODB.Connection object); and if I fill a dataset and do

report.SetDataSource(dataSet)

It tells me “The report has no tables.”

How do I populate a Crystal Reports report!? (the connection string/data location is not known at compile time)

  • 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-16T04:10:16+00:00Added an answer on May 16, 2026 at 4:10 am

    Creating Connection:

    /// <summary>
    /// Sets the connection.
    /// </summary>
    public void SetConnection()
    {
        _connection = new SqlConnection(Settings.Default.connectionString);
        if (_connection.State == System.Data.ConnectionState.Open)
        {
            _connection.Close();
        }
        _connection.Open();
    }
    
    /// <summary>
    /// Closes the connection.
    /// </summary>
    public void CloseConnection()
    {
        if (_connection.State == System.Data.ConnectionState.Open)
        {
            _connection.Close();
            _connection.Dispose();
        }
    }
    

    using above connection Populate dataset manually or Add a dataset to your solution to get data without writing connection codes. Say You have added Employee.XSD. Add a tableadapter in the XSD which will help you in pulling data from database, by auto generating queries and datatables. After doing all these things. Create a method somewhere in your project,

    Public DataTable GetAllEmployees()
    {
        Employee.EmployeeTableAdapter adapt = New Employee.EmployeeTableAdapter();
        DataTable dt = New DataTable();
        dt =    adapt.GetData();   // you can also use fill based on your criteria.
        return dt;   //your datatable with data
    }
    

    Now on Your Form add a reportviewer control.

    ReportViewer1 rpt = New ReportViewer();
    ReportDocument rptDoc = new ReportDocument();
    rptDoc.Load("path of rpt file");
    rptDoc.SetDataSource(GetAllEmployees());
    rpt.Document =  rptDoc;
    rpt.Refresh();
    

    Before that From Crystal Report , add the fields of table on the report as per your requirement.

    Another Way To achieve

    Crystal Reports can be used over various objects. If you have scenario to bind it dynamically, see my answer below Then u can do one thing that is , add a new dataset to solution. Create a datatable and add required columns with appropriate data type. DO not add query or table adapter. Now from your code add a class file and create properties exactly similar to the datatable columns. Now set the datatable as source to report and add its column on the report.

    For example , if you have columns
    ID - integer
    EmpName - string
    Salary - double
    Department - string
    

    Create a class

    public class Employee
    {
      private SqlConnection _connection;
      public int ID {get;set;}
      public string EmpName {get;set;}
      public double Salary {get;set;}
      public string Department  {get;set;}
    
    
    
    /// <summary>
    /// Sets the connection.
    /// </summary>
    public void SetConnection()
    {
        //assuming connection string is placed in settings file from Project Properties.
        _connection = new SqlConnection(Settings.Default.connectionString);
        if (_connection.State == System.Data.ConnectionState.Open)
        {
            _connection.Close();
        }
        _connection.Open();
    }
    
    /// <summary>
    /// Closes the connection.
    /// </summary>
    public void CloseConnection()
    {
        if (_connection.State == System.Data.ConnectionState.Open)
        {
            _connection.Close();
            _connection.Dispose();
        }
    }
    
    
      public DataTable GetEmployees()
      {
           DataTable dt = new DataTable("Employee");
           // using above connection
           SetConnection();
          using(SqlCommand command = new SqlCOmmand("commandText",_connection))
          {
             using(SqlDataReader reader = command.ExecuteReader())
             {
                  dt.Load(reader);
             }
          }
           return dt;
      }
    }
    

    Now create another function that will populate the datatable created inside the dtataset.

    public void PopulateDataTable()
    {
          DataTable dt = GetEmployee();
          Employee dsEmployee = New DataSet();
          dsEmployee.EmployeeDataTable dtEmp = new dsEmployee.EmployeeDataTable();
          dtEmp = dt;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since there doesn't seem to be a way for a user to take a
There doesn't seem to be any way as anonymous types derive from object. But
I keep coming back to this problem, since there doesn't seem to be a
There doesn't seem to be any tried and true set of best practices to
Since there is no way to join tables using Google App Engine datastore, I
Since there is no way that you can make the flash object transparent, there
I am trying to avoid using Net::SSH::Perl library since there is some problems in
I primarily work in PHP and prefer to do so since there seem to
It may seem a bit odd to ask this since there are several solutions
There doesn't seem to be a clear answer to this in the documentation. I'm

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.