This works for most of my reports..
for (int i = 0; i < theReport.Database.Tables.Count; i++) { myTable = theReport.Database.Tables[i]; myLog = myTable.LogOnInfo; myLog.ConnectionInfo.UserID = "user"; myLog.ConnectionInfo.Password = "password"; myTable.ApplyLogOnInfo(myLog); myTable.Location = myLog.TableName; }
But one of my reports (attached) gives:
This field name is not known.
Details: errorKindError in File
If I add -1 to this line:
for (int i = 0; i < theReport.Database.Tables.Count-1; i++)
then the attached report works.. but then all of my other working reports quit working..
What is going on?
VS2012 with CRforVS 13.0.5 coded in C#
I tried switching it to this, but got the same errorKindError.. but other reports work fine.
foreach (CrystalDecisions.CrystalReports.Engine.Table myTable in theReport.Database.Tables)