Hi,
I'm writing a 'general purpose' back-end, that needs to provide basic operations, to load a Crystal Reports report.
Using the connection string I get from the client app (a test program, at the moment), I build a ConnectionInfo object and apply it to the table(s) of the selected report (+ sub reports):
CRS.TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
tableLogOnInfo.ConnectionInfo.ServerName = connectionInfo.ServerName;
tableLogOnInfo.ConnectionInfo.DatabaseName = connectionInfo.DatabaseName;
tableLogOnInfo.ConnectionInfo.UserID = connectionInfo.UserID;
tableLogOnInfo.ConnectionInfo.Password = connectionInfo.Password;
table.ApplyLogOnInfo(tableLogOnInfo);
If I halt the debugger on the last line, table contains the correct information. Once I execute the ApplyLogOnInfo, it seems to have restored the original connection, provided in the report itself.
The reports used are delivered to me, I have zero control regarding the content, so I have to make them work as is.
Any idea why ApplyLogOnInfo doesn't accept my changes?
Thx.
PS: I am using Visual Studio 2010, so with Crystal Reports 2011
I'm writing a 'general purpose' back-end, that needs to provide basic operations, to load a Crystal Reports report.
Using the connection string I get from the client app (a test program, at the moment), I build a ConnectionInfo object and apply it to the table(s) of the selected report (+ sub reports):
CRS.TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
tableLogOnInfo.ConnectionInfo.ServerName = connectionInfo.ServerName;
tableLogOnInfo.ConnectionInfo.DatabaseName = connectionInfo.DatabaseName;
tableLogOnInfo.ConnectionInfo.UserID = connectionInfo.UserID;
tableLogOnInfo.ConnectionInfo.Password = connectionInfo.Password;
table.ApplyLogOnInfo(tableLogOnInfo);
If I halt the debugger on the last line, table contains the correct information. Once I execute the ApplyLogOnInfo, it seems to have restored the original connection, provided in the report itself.
The reports used are delivered to me, I have zero control regarding the content, so I have to make them work as is.
Any idea why ApplyLogOnInfo doesn't accept my changes?
Thx.
PS: I am using Visual Studio 2010, so with Crystal Reports 2011