Click here to Skip to main content
16,004,507 members
Home / Discussions / C#
   

C#

 
GeneralRe: please help C#.NET 2003 Pin
ap_sa17-Mar-06 10:51
ap_sa17-Mar-06 10:51 
Questionband object problem Pin
elraton17-Mar-06 10:10
elraton17-Mar-06 10:10 
AnswerRe: band object problem Pin
Ed.Poore17-Mar-06 12:53
Ed.Poore17-Mar-06 12:53 
GeneralRe: band object problem Pin
elraton18-Mar-06 17:41
elraton18-Mar-06 17:41 
QuestionSending WebService request from different port Pin
C#lueless17-Mar-06 9:34
C#lueless17-Mar-06 9:34 
QuestionNeed C# algorithm... Pin
KORCARI17-Mar-06 9:28
KORCARI17-Mar-06 9:28 
AnswerRe: Need C# algorithm... Pin
Christian Graus17-Mar-06 9:35
protectorChristian Graus17-Mar-06 9:35 
QuestionCrystal Reports.NET, Push method, Login failed Pin
Glenn E. Lanier II17-Mar-06 9:23
Glenn E. Lanier II17-Mar-06 9:23 
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.Text;

System.Data.OracleClient.OracleDataAdapter adapter = new System.Data.OracleClient.OracleDataAdapter();
adapter.SelectCommand = localCmd;
adapter.Fill(ds, "EMPLOYEE"); // Name must match name in Dataset

// Create Report
CrystalReportPositiveEmployees report = new CrystalReportPositiveEmployees();

Tried with/without this section
CrystalDecisions.Shared.TableLogOnInfo login = new CrystalDecisions.Shared.TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in report.Database.Tables)
{
login = tbl.LogOnInfo;
login.ConnectionInfo.ServerName = "myComputer";
login.ConnectionInfo.UserID = "myUser";
login.ConnectionInfo.Password = "myPass";
tbl.ApplyLogOnInfo(login);
}

// Tell report to use dataset
report.SetDataSource(ds);

// Create new form, report viewer has been declared public
formReportViewer dlg = new formReportViewer();
dlg.crystalReportViewer1.ReportSource = report;

// No errors, until next command executes
dlg.ShowDialog();


Thanks,
Glenn
QuestionuxTheme. Where are the taskbar buttons? Pin
elraton17-Mar-06 7:33
elraton17-Mar-06 7:33 
AnswerRe: uxTheme. Where are the taskbar buttons? Pin
Thomas Stockwell18-Mar-06 13:53
professionalThomas Stockwell18-Mar-06 13:53 
QuestionC# mysql problem Pin
babamara17-Mar-06 7:07
babamara17-Mar-06 7:07 
Questiondynamic function call Pin
vatzcar17-Mar-06 5:50
vatzcar17-Mar-06 5:50 
GeneralRe: dynamic function call Pin
Guffa17-Mar-06 6:09
Guffa17-Mar-06 6:09 
GeneralRe: dynamic function call Pin
vatzcar17-Mar-06 16:46
vatzcar17-Mar-06 16:46 
AnswerRe: dynamic function call Pin
Guffa19-Mar-06 9:49
Guffa19-Mar-06 9:49 
GeneralRe: dynamic function call Pin
vatzcar20-Mar-06 5:07
vatzcar20-Mar-06 5:07 
AnswerRe: dynamic function call Pin
engsrini17-Mar-06 7:20
engsrini17-Mar-06 7:20 
GeneralRe: dynamic function call Pin
vatzcar17-Mar-06 19:47
vatzcar17-Mar-06 19:47 
QuestionCut/Copy/Paste for TreeView Pin
zaboboa17-Mar-06 5:08
zaboboa17-Mar-06 5:08 
AnswerRe: Cut/Copy/Paste for TreeView Pin
Ed.Poore17-Mar-06 12:52
Ed.Poore17-Mar-06 12:52 
QuestionHow to get the Enum item names using Reflection Pin
engsrini17-Mar-06 3:07
engsrini17-Mar-06 3:07 
AnswerRe: How to get the Enum item names using Reflection Pin
mcljava17-Mar-06 4:22
mcljava17-Mar-06 4:22 
QuestionRe: How to get the Enum item names using Reflection Pin
engsrini17-Mar-06 5:53
engsrini17-Mar-06 5:53 
AnswerRe: How to get the Enum item names using Reflection Pin
Guffa17-Mar-06 6:16
Guffa17-Mar-06 6:16 
QuestionRe: How to get the Enum item names using Reflection Pin
engsrini17-Mar-06 7:08
engsrini17-Mar-06 7:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.