出现上面的问题是由于你设置了密码,请参照我下面给你的。设置报表跟数据库表的连接如果数据库密码不为空的话,则应该添加以下代码安全登陆:
ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("cr1.rpt"));
//设置按名称指定的表的 TableLogOnInfo 对象。 
TableLogOnInfo logOnInfo = new TableLogOnInfo();//对报表中的每个表进行循环
//报表中数据集的Table 对象的个数
for(int i=0;i==Report.DataBase.Tables.Count-1;i++)
{
     // 为报表中的表设置连接信息。
     
     // 设置服务器或 ODBC 数据源名称、数据库名称、
     // logonInfo.ConnectionInfo.ServerName = server
     // logonInfo.ConnectionInfo.DatabaseName = database   //设置用于登录到数据源的用户名
   logOnInfo.ConnectionInfo.UserId = "sa";
   //设置用于登录到数据源的“密码”
   logOnInfo.ConnectionInfo.Password = "yourpwd";
   // 将连接信息应用于表。
   Report.DataBase.Tables[i].ApplyLogOnInfo(logOnInfo);
}
CrystalReportViewer1.ReportSource = Report;
//当然如果密码为空的话也同样可以使用这种方法的