RSS 2.0 | Atom 1.0 | CDF

Search

Categories

Archive

Blogroll

Sign In

# Thursday, July 27, 2006
Thursday, July 27, 2006 4:31:47 PM (GMT Daylight Time, UTC+01:00) ( Asp.Net )
i ran into a problem with my Crystal Reports.  instead of using the usual Typed Dataset approach, where you use Report.SetDataSource(DataSet), i decided that was too much hastle and it seems faster and simpler just to design the query in the Crystal Reports 'wizard', and then supply parameters and set the record filter appropriately.  what i didn't know was that it was insanely complicated to direct the report to a different database path at runtime (such as most users would have in their deployment environment, whether for Access or SQL server). 

i was using Report.SetDataBaseLogon("admin", "") etc and all sorts of variations but none of them were working.  I kept getting Logon Failed exceptions.  Apparently you need to iterate through each table used in the report and set the source database for each one.  Not only that, but neither of the following lines of code has any effect:
Report.Database.Tables[i].SetDataSource("admin", "", DbPath, "")
Report.Database.Tables[i].LogOnInfo.ConnectionInfo.ServerName = DbPath
apparently you have to create a TableLogOnInfo object and use ApplyLogOnInfo() with that on each table. 
here is what does work:
TableLogOnInfo t = new TableLogOnInfo();
t.ConnectionInfo.ServerName = dbPath;            
for(int i=0; i<rpt.Database.Tables.Count; i++)
    rpt.Database.Tables[i].ApplyLogOnInfo(t);

Comments [3] | | # 
# Tuesday, July 25, 2006
Tuesday, July 25, 2006 11:05:25 AM (GMT Daylight Time, UTC+01:00) ( )
i installed vista on a second partition and when i went back to XP, the LAN reported a network cable unplugged.  of course it wasn't, and apparently the IPv6 protocols used in Vista caused some confusion between the router and network card.  turning off the computer and router for a minute or two seems to do the trick!

this useful post explains it better


Comments [0] | | #