try
{
ReportDocument RepDoc = new ReportDocument();
ConnectionInfo connectionInfo = new ConnectionInfo();
string RepPath = Application.StartupPath + @"\Reports\crReportFee.rpt";
RepDoc.Load(RepPath);
connectionInfo.ServerName = @".";
connectionInfo.DatabaseName = "Store";
connectionInfo.UserID = "sa";
connectionInfo.Password = "sa";
////Set Parameters
AverageStore frmst = (AverageStore)Application.OpenForms["AverageStore"];
RegistryKey regkey = Registry.CurrentUser;
regkey = regkey.CreateSubKey(@"Software\ControlShoppingSystem\Informations");
RepDoc.SetParameterValue("@StoreName", regkey.GetValue("StoreName"));
RepDoc.SetParameterValue("@CurrentDate", VarHolder.CurrentDate);
if (frmst.chkAllGoods.Checked)
RepDoc.SetParameterValue("@GoodCode", null);
else
RepDoc.SetParameterValue("@GoodCode", frmst.txtGoodCode.Text);
if (frmst.chkAllStores.Checked)
RepDoc.SetParameterValue("@StoreID", null);
else
RepDoc.SetParameterValue("@StoreID", frmst.cboStores.SelectedIndex + 1);
//End Parameters
crystalReportViewer1.ReportSource = RepDoc;
SetLogin(connectionInfo, RepDoc);
}
catch (Exception err)
{
OKForm frm = new OKForm();
frm.lblBodyText.Text = err.Message;
frm.ShowDialog();
}