我是 C# 的新手,我开发了小代码来运行我的 Crystal 报表,但它挂起机器,我正在使用 VS 2010 访问 2007 和 Crystal 报表 10 和 Crystl32.OCX。
我的代码是:
private void Form12_Load(object sender, EventArgs e)
{
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.DatabaseName = Application.ExecutablePath + "\\Pharma.accdb";
crConnectionInfo.UserID = "";
crConnectionInfo.Password = "";
cr1.LogOnInfo.Equals(crConnectionInfo); //("sa", "password", @"MS Access Database", "pharma");
ReportDocument reportDocument = new ReportDocument();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "CName";
paramDiscreteValue.Value = "AHmed";
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
this.cr1.RefreshReport();
this.cr1.Show();
}