This document focuses on how to display crystal reports with images using typed dataset. While displaying reports instead of querying to database, we can use already filled data tables. This design is based on Crystal Reports for Visual Studio .NET.


This BOK explains simple steps on how to create crystal reports using typed dataset. The instances in this document have been illustrated considering “Company” table which stores general data as well Logo images.

Create typed dataset

This is company master table schema which stores company information and company logo images.

Database Table schema:


Follow these steps to add typed data set in your report project.

Go to Project, Add, New Item, Data, then Data Set

Once data set is added in your project then drag and drop database table from server explorer.

In this example I have used Company table.

Data Table:


Create report and browse data table

  • Instead of using direct table from database we can use data table from typed data set 
  • Dataset is available under Project Data, then ADO.Net DataSets
  • Select the data table from available data source and add to selected tables section.
  • Once data table is added click “Ok” button to map the data table in crystal report.

 Fill data table in typed dataset

  • Fetch the data from database and fill it in the data table in dataset. 
  • This method returns the data set in display report method

public ReportsDS Report_GetReportData()  
    SqlConnection sqlConn = new SqlConnection();  
    sqlConn.ConnectionString = connectionString;  
    ReportsDS ReportDS = new ReportsDS();  
    string CompanyId = CachingHelper.ReadFromCache(Constants.CompanyId);  
        DataSet ds = new DataSet();  
        SqlCommand cmd = new SqlCommand();  
        cmd.CommandType = CommandType.Text;  
        cmd.CommandText = "SELECT * FROM Company WHERE Id ='" + CompanyId + "'";  
        cmd.Connection = sqlConn;  
        SqlDataAdapter da = new SqlDataAdapter(cmd);  
        da.Fill(ReportDS, ReportDS.Company.TableName);  
    } catch (Exception ex)   
    } finally  
        if (sqlConn.State != ConnectionState.Closed) sqlConn.Close();  
    return ReportDS;  

Display Reports

  • Create instance of Report Document and set DataSource as data table
  • Set ReportSource as Report Document in crystal report viewer
  • Call DisplayReport() method in events like button click.

private void DisplayReport()  
        ReportsDs ReportDS = new ReportsDs();  
        ReportDocument obj = new ReportDocument();  
        ReportDS = Report_GetReportData();  
        obj.FileName = “rptCompanyReport.rpt”;  
        obj.SetDataSource((DataTable) ReportDS.Company);  
        crystalReportViewer1.ReportSource = obj;  
    } catch (Exception ex)   
        Logging.CustomizedException(ref ex, false);