I've a very strange behavior setting the database logon at runtime. It doesn't work at all but in some way the report is able to retrieve it's data. More strangely if I debug the program and run one line at a time then it works fine. Finally I managed a very cumbersome solution setting the logon info three times. One time with the old connection info and two times with the new connection info. I know it sounds like black magic but it's true.
My environment is as follows:
Visual .net 2008
Crystal Reports 2008 SP 2
Informix Dynamic Server 10
Informix cli 2.81
The code for setting the database logon was like this before realizing it had no use:
ConInfo.ConnectionInfo.UserID = "xxxxxx"
ConInfo.ConnectionInfo.Password = "xxxxx"
ConInfo.ConnectionInfo.ServerName = "xxxxx"
ConInfo.ConnectionInfo.DatabaseName = "xxxxx"
For i = 0 To Report.Database.Tables.Count - 1
Report.Database.Tables(i).ApplyLogOnInfo(ConInfo)
Next
Edited by: ServetZar on Nov 20, 2009 12:29 PM