Without pointing out the number of examples and tutorials that are available..
I typically create a Report against the database I don't use datasets. I also typically use Stored Procedures for Reports - they are quicker and have distinct advantages when you have sub-reports. the following link will show you how to use datasets though;
Code Project - Creating Crystal Reports using C# with Datasets[
^]
You need to add the following references - assuming Windows Forms;
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.ReportSource
CrystalDecisions.Shared
CrystalDecisions.Windows.Forms
I am using VS 2015 with Crystal Reports 13.2 - refer to below link for runtime download;
Crystal Reports, Developer for Visual Studio Downloads - Business Intelligence (BusinessObjects) - SCN Wiki[
^]
You will also need to add the following "usings"
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
You have not specified which report - this is done as follows;
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load("Put the full path and file name here");
Then loop through the Report Parameters and set them - I typically use the following;
if(rptDoc.DataDefinition.ParameterFields.Count > 0)
{
foreach(ParameterFieldDefinition crDef in rptDoc.DataDefinition.ParameterFields)
{
if(crDef.ReportName == string.Empty)
{
object objValue = "What ever value I want to use";
rptDoc.SetParameterValue(crDef.ParameterFieldName, objValue);
}
}
}
Next thing to do is create a Crystal reports ConnectionInfo, this is then passed to the Report
ConnectionInfo crConn = new ConnectionInfo();
crConn.ServerName = "My DB Server Name";
crConn.DatabaseName = "My Database Name";
crConn.UserID = "DB User Name";
crConn.Password = "DB Password";
Tables crTables = rptDoc.Database.Tables;
for(int i = 0; i < crTables.Count; i++)
{
Table crTable = crTables[i];
TableLogOnInfo tblInfo = crTable.LogOnInfo;
tblInfo.ConnectionInfo = crConn;
crTable.ApplyLogOnInfo(tblInfo);
}
this.crystalReportsViewerFrm.ReportSource = rptDoc;
Good Luck