Crystal Reports.NET, Push method, Login failed
-
I want to display a simple Crystal Report (already, I think this is an oxymoron) in a Windows Form using a dataset (I'd prefer to do all the database work in my code, rather than letting CR do it). All of my C# code is using Oracle.DataAccess.Client, but when I tried to create a new DataSet, VS said I had to use the Microsoft Oracle object. I did, created a DataSet with one table, EMPLOYEE. I then created my report that lists four items from the table -- no grouping, no counting, just a list. Then, I created a Windows Form that gathers the required parameters for my query, and using those parameters, build the SQL. I use the SQL to fill the EMPLOYEE table in the DataSet created earlier. If I look, the table has 700+ rows after filling. Then, I create a report object, set the datasource to the filled dataset, and set the Crystal Reports Viewer's ReportSource to the report. Seems straightforward, no errors. However, when I try to display the new form (that contains the crystalReportViewer), I am presented with a logon dialog box, asking for server, database, username, password. Even if I supply all of these items, it fails to logon. The form containing the viewer is shown, but there is no report. I tried filling the dataset with the MS Oracle connection/command/dataadapter, but it made no difference. I also tried setting the username/password for each table in the report after the report object was created, but no luck either. I read http://support.businessobjects.com/forums/message.asp?fid=251&sk=5&ps=25&pn=1&mid=152400#m152400, and a couple of other articles as well (http://www.codeproject.com/aspnet/crystal\_report.asp#xx852522xx, http://aspalliance.com/265, and http://www.dotnetjunkies.com/Article/790775A0-C493-46D8-ABE0-40CA588D33D3.dcik). Any thoughts on how to make this work, and/or a better place to ask?
**// Create the dataset** DatasetReportPositiveEmployees ds = new DatasetReportPositiveEmployees(); string sSQL = "SELECT DISTINCT empID, empFName, empLName, empAcctNum from Employee " + "LEFT INNER JOIN TestResult ON empID = testEmployeeID " + "WHERE (testResult IN (SELECT resultID FROM Result WHERE resultTreatAsPositive=1))"; System.Data.OracleClient.OracleConnection localConn = new System.Data.OracleClient.OracleConnection(settings.ConnectionString); localConn.Open(); System.Data.OracleClient.OracleCommand localCmd = new System.Data.OracleClient.OracleCommand(); localCmd.Connection = localConn; localCmd.CommandText = sSQL; localCmd.CommandType = CommandType.T