水晶报表,别名识别问题
水晶报表,运行时不识别表别名是什么问题啊,哪位大神能帮忙解决下,因为同一张表多次使用,所以需要用到别名,但是读取的时候不识别,报错为,该表不存在。
代码:
for (int i = 0; i < rptDoc.Database.Tables.Count; i++)
{
CrystalDecisions.Shared.TableLogOnInfo logonInfo = rptDoc.Database.Tables[i].LogOnInfo;
logonInfo.ConnectionInfo.ServerName = myLoginInfo.DBServer;
logonInfo.ConnectionInfo.DatabaseName = myLoginInfo.DBName;
logonInfo.ConnectionInfo.UserID = myLoginInfo.DBUserID;
if (myLoginInfo.DBPassword != null)
{
logonInfo.ConnectionInfo.Password = myLoginInfo.DBPassword;
}
else
{
logonInfo.ConnectionInfo.Password = System.Configuration.ConfigurationManager.ConnectionStrings["Password"].ToString();
}
logonInfo.ConnectionInfo.IntegratedSecurity = false;
logonInfo.ConnectionInfo.Type = CrystalDecisions.Shared.ConnectionInfoType.SQL;
rptDoc.Database.Tables[i].ApplyLogOnInfo(logonInfo);
rptDoc.Database.Tables[i].Location =rptDoc.Database.Tables[i].Name; // caters for RDO connection
}
------解决方案--------------------
接分