Symptom
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
This will result in either a "Logon failed error" or a "Database Connector error" error
Cause
Resolution
HOST=IPADDRESS or COMPUTERNAME
SERVICE=TCP PORT like 1527 for instance
PROTOCOL=olsoctcp
In your code, set the table location as follows:
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
table.location
="DatabaseName:hostname:tablename";
}
Refer to the sample code named "CS_Win_RDObjMod_DBLogon" for more information about changing the table location at runtime:
Keywords
Changing an Informix table location at runtime based on a native connection with Crystal Report .NET SDK , 9472972 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To