Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I dont know how can you connect with dataset. From your post what i assume is that you probably are populating a dataset and using this dataset for databinding with the report.</p> <p>In that case you should provide a name to your table in the dataset.</p> <p>The name of the table in the dataset must exactly match the the table or view on which the report is designed. Otherwise Crystal report will not be able to find it.</p> <pre><code>ds.Tables[0].Name="yourTableorViewNameHere"; </code></pre> <p>also you need to provide login info to your report.</p> <pre><code>private void myLogonInfo(CrystalDecisions.CrystalReports.Engine.ReportDocument myReport) { TableLogOnInfo logOnInfo = new TableLogOnInfo(); string server = "MyServer"; string userID = "User1"; string passwd = "MyPw"; string DBNAME = "MyDB"; int i = 0; for (i = 0; i &lt;= myReport.Database.Tables.Count - 1; i++) { logOnInfo.ConnectionInfo.ServerName = server; logOnInfo.ConnectionInfo.UserID = userID; logOnInfo.ConnectionInfo.Password = passwd; logOnInfo.ConnectionInfo.DatabaseName = DBNAME; myReport.Database.Tables[i].ApplyLogOnInfo(logOnInfo); } } </code></pre> <p><strong>EDIT</strong></p> <p>And here is the code to initialize the report</p> <pre><code>private void ShowRep(dataset ds) { ReportDocument rptDoc = new ReportDocument(); rptDoc.Load(Server.MapPath("MyReport.rpt")); //either assign the dataset to the report here rptDoc.SetDataSource(ds); //or provide the login details //myLogonInfo(rptDoc); //assign record filtering here //rptDoc.RecordSelectionFormula = "{RDNewCollections.tdate}&gt;=" + GetCrystalDate(ffdt.Text) ; // set some report parameters rptDoc.SetParameterValue(0, ffdt.Text); rptDoc.SetParameterValue(1, tdt.Text); //finally assign the report to the reportviewer Crv.ReportSource = rptDoc; } </code></pre> <p>You can call this from page load.</p> <p>If you are using datasets then no need to pass logonifo. If you are not using dataset then you must call logoninfo.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload