ReportDocument CrReport = new ReportDocument();
CrReport.Load("report\\report.rpt");
ParameterFields ParamFields=new ParameterFields();
ParamField=new ParameterField();
ParameterDiscreteValue spValue1=new ParameterDiscreteValue();
ParamField.ParameterFieldName ="@field";
ParamField.ParameterType = CrystalDecisions.Shared.ParameterType.StoreProcedureParameter;
spValue1.Value = value;
ParamField.CurrentValues.Add(spValue1);
ParamFields.Add(ParamField);
TableLogOnInfo myTableLogonInfo = new
CrystalDecisions.Shared.TableLogOnInfo();
myTableLogonInfo = CrReport.Database.Tables[0].LogOnInfo;
myTableLogonInfo.ConnectionInfo.ServerName = "Servername";
myTableLogonInfo.ConnectionInfo.DatabaseName = "DB";
myTableLogonInfo.ConnectionInfo.UserID = "sa";
myTableLogonInfo.ConnectionInfo.Password="pass";
CrReport.Database.Tables[0].ApplyLogOnInfo( myTableLogonInfo);
CrystalReportViewer1.ParameterFieldInfo = ParamFields;
CrystalReportViewer1.ReportSource = CrReport ;
Post a Comment