tanveer ahmed

tanveer ahmed

  • NA
  • 2
  • 8.2k

C# Crystal Report Error-Help required

Aug 7 2010 1:12 PM
Hi,
This is my first post, i am very new to this forum, please avoid if any mistake in writing.

I have a problem, that crystal report does not show any record when load.
I have created a Dataset in which only one table 'tblPurchaseInv' is bind.
I have created report and drag field from dataset onto report. 

I have another form called frmPurchaseInv through which i want to generate invoice of last invoice which is recently saved into database. I called report on click event of SAVE button of frmPurchaseInv. The code is:

CrystalDecisions.Shared.TableLogOnInfo myLogin;
rptPurInv rpt = new rptPurInv();
frmReportViewer frm = new frmReportViewer();

foreach (CrystalDecisions.CrystalReports.Engine.Table myTable in rpt.Database.Tables)
{
myLogin = myTable.LogOnInfo;

myLogin.ConnectionInfo.ServerName = ".\\SQLExpress";
myLogin.ConnectionInfo.UserID = "";
myLogin.ConnectionInfo.Password = "";
myTable.ApplyLogOnInfo(myLogin);
}

frm.MdiParent = this.MdiParent;
frm.Show();

frm.CrViewer.SelectionFormula = "{ViewPurInv.Purchase_Inv} = " + tbpinv.Text;//tbpinv.text is the text box having invoice number that is last saved into database
frm.CrViewer.Refresh();
frm.CrViewer.ReportSource = rpt;

When report open in Crystal Report viewer, no record shown. 
Please help me!!