By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,538 Members | 2,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,538 IT Pros & Developers. It's quick & easy.

C# forms app - Crystal Reports question

P: 69
Hello all...

I have a C# forms application that I am developing using MS Visual Studio 2005. I am trying to add some Crystal Reports to this application using the built in Crystal Reports tools with Visual Studio.

It seems like it should be pretty straight forward, but no matter what I do I can't get my reports to actually show data. Here's the info:

I created a crystal report viewer on a form. I created a crystal report that has a data source of a table in my database. Nothing fancy... just showing some of the fields from the table on the report. Whenever I use the preview button in the design of the report it fills it in with generic data (not pulling from my database).

I have the following code to load the report into the viewer:

Expand|Select|Wrap|Line Numbers
  1. TestReport rptTest = new TestReport();
  2.             CrystalDecisions.Shared.ConnectionInfo crDbConnection = new
  3.               CrystalDecisions.Shared.ConnectionInfo();
  4.             crDbConnection.IntegratedSecurity = true;
  5.             crDbConnection.DatabaseName = "accessgwc";
  6.             crDbConnection.ServerName = "Access-server2";
  7.             CrystalDecisions.CrystalReports.Engine.Database crDatabase =
  8.               rptTest.Database;
  9.             CrystalDecisions.Shared.TableLogOnInfo oCrTableLoginInfo;
  10.             foreach (CrystalDecisions.CrystalReports.Engine.Table oCrTable in
  11.               crDatabase.Tables)
  12.             {
  13.                 oCrTableLoginInfo = oCrTable.LogOnInfo;
  14.                 oCrTableLoginInfo.ConnectionInfo = crDbConnection;
  15.                 oCrTable.ApplyLogOnInfo(oCrTableLoginInfo);
  16.             }
  19.             crystalReportViewer1.ReportSource = rptTest;
At runtime it loads the report when I push the button, and I can see the data labels, but no data. All of my other database functions (and there are a lot of them) work fine in this application, so I know it's not a database connectivity problem. I think I'm just such a newbie to Crystal Reports, that I'm missing something.

Does anyone know what I'm missing? Is there a way I can preview this report and see real data in it (prior to runtime)? I would really appreciate any help.

If you need more details just let me know.

Apr 3 '08 #1
Share this Question
Share on Google+
1 Reply

P: 69
Sorry to bump this message, but I'm really hoping someone can lead me in the right direction.

Thanks in advance!
Apr 3 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.