Crystal reports does not found database connection

Posts   
 
    
Posts: 18
Joined: 26-Jun-2006
# Posted on: 05-Oct-2006 13:46:34   

Hi,

I am working in a project using C# and LLBLGen Pro. everything is ok until I tried to create a report using crystal reports that came with visual studio 2005. Look like visual does not see data base connection.

please could you guide me how to resolve this issue.

thanks,

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 05-Oct-2006 13:57:43   

How do you pass the connection to CR?

Posts: 18
Joined: 26-Jun-2006
# Posted on: 05-Oct-2006 22:12:36   

Its is the problem I do not how to do it?

could you help me?

mihies wrote:

How do you pass the connection to CR?

mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 06-Oct-2006 00:15:54   

Never used CR but I suppose you have to pass connection string somewhere...

Posts: 18
Joined: 26-Jun-2006
# Posted on: 06-Oct-2006 02:22:02   

Yes, but I do not how to do it.

When I try to create a report, crystal reports can not see data layer created for llblGEN Pro.

Thanks for your help, but still I am stock.

is there somebody else that can help me, What I am trying to do is created a report with crystal report that came with visual studio

thanks,

mihies wrote:

Never used CR but I suppose you have to pass connection string somewhere...

Midnight
User
Posts: 14
Joined: 07-Sep-2006
# Posted on: 06-Oct-2006 04:06:43   

I have just spent the past week battling Crystal Reports. I vowed never to use it again over 10 years ago after trying to create a report in VB3. Crystal Reports is attrocious. However I needed it for a current project. I am using VB.NET and version 1.1 but I think this will still work for you. I also found that the easiest way was to use Datasets. I have also vowed never to use them but they seemed to work best with Crystal reports. Create a dataset so that CR knows what the schema is. Use it on the report. In your code create a configuration reader and get the database from the App.Config file. Fill the dataset using a dataadapter. Create an instance of the report you created and then attach the dataset using the Report.SetDatasource(DatasetName) method.

Richard

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 06-Oct-2006 08:10:04   

LLBLGen Pro reads the connection string from the config file of your application, so you shouldn't have to set it. I used CR about 8 years ago for the last time and as Midnight I also vowed to never use it again, so I have no idea how to use it nowadays, other than that it should just consume the entities/constructs like any other binding object.

But your code in a CR fails or something?

Frans Bouma | Lead developer LLBLGen Pro
mihies avatar
mihies
User
Posts: 800
Joined: 29-Jan-2006
# Posted on: 06-Oct-2006 09:42:04   

Otis wrote:

...as Midnight I also vowed to never use it again, so I have no idea how to use it nowadays....

smile same story here.

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 06-Oct-2006 13:51:03   

The best way that I found to work with CR and LLBLGen Pro was to use typedlist and pass it as datasource to CR. It is easy to create typedlist with the LLBLGen Pro designer, fill the typedlist and assign it to the CR's report document instance. The only problem that you can find is at the design time inside CR, because you need a schema of your data to design your report; but that was solved with the typedlist schema generator utility.

Please read the following: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7774

Posts: 18
Joined: 26-Jun-2006
# Posted on: 09-Oct-2006 18:26:47   

Simply CR does not see the connection string that LLBLGen Pro reads. The only way that it works it creating the database connection again, but I dont want it. I want to bind data the same way that I do with WIN FORMS.

Do you have any example that I can follow.

Thanks,

Otis wrote:

LLBLGen Pro reads the connection string from the config file of your application, so you shouldn't have to set it. I used CR about 8 years ago for the last time and as Midnight I also vowed to never use it again, so I have no idea how to use it nowadays, other than that it should just consume the entities/constructs like any other binding object.

But your code in a CR fails or something?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 09-Oct-2006 19:17:17   

I don't understand... confused you should run llblgen pro code and the connection string is read by llblgen pro code for you, CR doesn't see the connection string nor needs it, it should just execute llblgen pro code.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 22
Joined: 20-Sep-2006
# Posted on: 10-Oct-2006 19:59:28   

cadolfo_2000 wrote:

Simply CR does not see the connection string that LLBLGen Pro reads. The only way that it works it creating the database connection again, but I dont want it. I want to bind data the same way that I do with WIN FORMS.

Do you have any example that I can follow.

Thanks,

What I think you're asking for here is to select an entity as an object type and bind to it in the same way you bind to an object in a windows form, in the crystal designer.

If this is the case, than I'm sorry to tell you that you can't do that. The project data is only in the project scope, so if you're creating the crystal report in your UI project, you won't be able to see the DAL objects. This (IMHO) is a pretty serious design flaw in crystal component. Regardless, your not without options. You could

a.) Create the crystal report in the DAL at which point you would be able to see the entity object. However going this route you would have to re-add your reports to this project every time you regenerated your DAL, so I'm pretty sure you don't want this option.

b.) You could go with Rogelio's option which is a pretty elegant approach to the problem

c.) You could create a strong typed dataset manually and then fill the strong type set with the entity data and create the report of the dataset.

d.) You could use a sproc in the database and have the crystal designer bind to the procedure.

Personally when I create crystal reports (which is more than I care to admit) I go with option d. I create the reports in the crystal designer (external to VS) using their "pull" model. I then use a crystal report document object to call the report. I actually have a table with the reports and report parameters along with their control types so that I can add reports to the software without rebuilding the code.

The biggest pro that I see in going this way is that reports are the items most often changed within software (or at least they are in my experience) by doing it this way, I can simply modify the proc and copy a new report file over, no rebuild is necessary.

That's my .02 simple_smile

Justin