Link to home
Start Free TrialLog in
Avatar of ultrafish
ultrafish

asked on

set logon info for subreport

hi all,

I am using CR 8.5 and ASP .net 2002 (C#), my subreport requires login to a file dsn which need a username and password,
I am using asp .net 2002 as the front end, how can I set these login information in the code? here is the code I have right now, (from another nice expert here), however, it doesn't work for me, please help: in here, I don't know where can I set the file dsn, say for example the file is "C:\dsn1.dsn", what can I do? Thanks a lot!!!!

// Create report instance                  
ReportDocument reportDocument = new ReportDocument();
                  
                  
reportDocument.Load("C:\\Projects\\Accpac\\Product Billing\\merge_prompt_for_custID.rpt");  // location of report

reportDocument.SetDatabaseLogon("sa", "now2k1"); // username and password for DB access

// Assign parameters to report      
reportDocument.SetParameterValue("CUSTOMER_ID", "1000003");
reportDocument.SetParameterValue("Months", "2004-05");
reportDocument.SetParameterValue("RUNDATE", DateTime.Now.ToShortDateString());
                  
// Print
reportDocument.PrintOptions.PrinterName = "Adobe PDF";
reportDocument.PrintToPrinter(1, false, 0, 0);

// Export - This will require export options to be defined.
reportDocument.Export();
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial