Skip to content

Instantly share code, notes, and snippets.

@hidayat365
Last active December 20, 2015 01:49
Show Gist options
  • Save hidayat365/6052000 to your computer and use it in GitHub Desktop.
Save hidayat365/6052000 to your computer and use it in GitHub Desktop.
Menampilkan Report Crystal Report
public void ShowProfitLossReport(int month, int year)
{
InitializeConnectionInfo();
rpt = new Finance.rptProfitLoss();
rpt.ParameterFields["bulan"].CurrentValues.AddValue(month);
rpt.ParameterFields["tahun"].CurrentValues.AddValue(year);
rpt.ParameterFields["span"].CurrentValues.AddValue("MONTHLY");
SetReportLogonInfo(rpt);
crViewer1.ReportSource = rpt;
crViewer1.Zoom(1);
}
private void InitializeConnectionInfo()
{
cnInfo = new ConnectionInfo();
cnInfo.ServerName = Config.Server;
cnInfo.DatabaseName = "accounting";
cnInfo.UserID = "sa";
cnInfo.Password = "*****";
}
private void SetReportLogonInfo(ReportDocument reportDocument)
{
Tables tables = reportDocument.Database.Tables;
foreach (Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = cnInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment