大家看看我现在调用报表的代码:
ReportClass oCR = new ReportClass();
CrystalDecisions.Shared.ParameterValues mypaVal;
CrystalDecisions.Shared.ParameterDiscreteValue mypaDVal;
string strpath = Server.MapPath(str);
oCR.FileName = strpath;
mypaVal = new CrystalDecisions.Shared.ParameterValues();
mypaDVal = new CrystalDecisions.Shared.ParameterDiscreteValue();
mypaDVal.Value = date.SelectedValue.ToString();
mypaVal.Add(mypaDVal);
CrystalReportViewer1.ReportSource = oCR;
CrystalReportViewer1.DataBind();
oCR.DataDefinition.ParameterFields["date"].ApplyCurrentValues(mypaVal);现在有一个问题:
1、调报表时出现要输入数据库连接密码
2、我输入完密码后,不出现任何信息,改变查询时间才能看见报表,如果有数据,能看见内容,如果没数据,看见报表头有谁知道问题怎么解决?
急!!!
ReportClass oCR = new ReportClass();
CrystalDecisions.Shared.ParameterValues mypaVal;
CrystalDecisions.Shared.ParameterDiscreteValue mypaDVal;
string strpath = Server.MapPath(str);
oCR.FileName = strpath;
mypaVal = new CrystalDecisions.Shared.ParameterValues();
mypaDVal = new CrystalDecisions.Shared.ParameterDiscreteValue();
mypaDVal.Value = date.SelectedValue.ToString();
mypaVal.Add(mypaDVal);
CrystalReportViewer1.ReportSource = oCR;
CrystalReportViewer1.DataBind();
oCR.DataDefinition.ParameterFields["date"].ApplyCurrentValues(mypaVal);现在有一个问题:
1、调报表时出现要输入数据库连接密码
2、我输入完密码后,不出现任何信息,改变查询时间才能看见报表,如果有数据,能看见内容,如果没数据,看见报表头有谁知道问题怎么解决?
急!!!
我用一下代码oCR.SetDatabaseLogon("user", "password", "数据源","数据库");后提示错误
logOnInfo.ConnectionInfo.ServerName = "";
logOnInfo.ConnectionInfo.DatabaseName = DatabaseName;
logOnInfo.ConnectionInfo.UserID = UserId;
logOnInfo.ConnectionInfo.Password = password;
myRptSource.ReportDocument.Database.Tables[0].ApplyLogOnInfo(logOnInfo);//myRptSource是CrystalReportSource控件