Print Page | Close Window

setting data source location at runtime

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=8511
Printed Date: 04 May 2024 at 6:17am


Topic: setting data source location at runtime
Posted By: ishan
Subject: setting data source location at runtime
Date Posted: 30 Nov 2009 at 9:50pm
I m using vb6 as frontend, crystal report 9.0 as reporting tool, oracle 8i as backend and odbc as connection interface

Let's say my application is being used in two companies. And for each company i used separate odbc, user and password.(user as schema in oracle). But I have same code and reports for both companies.
I just use setting file to switch between company database which consist of dsn name, user name and password.
The problem is when I develop a report I need to create two separate reports and set the data source location manually in crystal report 9 IDE and place them in separate folders companywise.

How can I use the same report for two different schema when all database structure is same, without having to change the datasource location manually everytime I develop a new one.
How can i do it at run time.

I hope I get an answer this time.

Thankx in advance




-------------
Ishwor



Replies:
Posted By: lockwelle
Date Posted: 01 Dec 2009 at 6:16am
I don't know about vb6 and CR 9, but I would look into pushing the data to the report and making it independent the obdc driver.  In .Net and CR XI, I use ADO.Net to pass the data to the report from my application.  I am guessing that this is not a 'new' technology for CR XI.  It would be simplest if the report runs from a stored proc, then have you app call the stored proc and pass the results to CR.
 
HTH


Posted By: ishan
Date Posted: 01 Dec 2009 at 8:17pm
No I just pass selection criteria to the report. How are Reports are designed independently of odbc driver and how can data be pushed to the report. When u design the report u need to define the connection, don't u? I think so. So when u design the report using a specific connection, it becomes rigid to that particular connection information. So when connection information is changed in the application, it doesn't work.

-------------
Ishwor


Posted By: lockwelle
Date Posted: 02 Dec 2009 at 6:06am
that's why you use something like ado.net which is a disconnected recordset.  Another way to do this is to set the dataconnection as OLE and then set the connection at runtime, we've done this as well, but the disconnected recordset is way easier. I would try searching the internet for crystal reports and push method. I know it can be done in XI disconnected recordset, I not sure about CR9.
 
HTH


Posted By: ishan
Date Posted: 02 Dec 2009 at 8:24pm
Does that mean there is no solution for my problem?
It's so frustrating, I don't get any solution for my problem.
Anyway thanx. At least u took some time for me.

I hope if you can ask others in this forum to help me out.

Thanx a lot.

-------------
Ishwor


Posted By: lockwelle
Date Posted: 03 Dec 2009 at 6:09am

No, I gave a solution, use an ole driver and set the connection via your app. 

You could also have your app get the dataset or datatable and pass the datatable to the report.  You don't need to have the report get the data, but if that is the method that you want to use, then you can use the ole driver. 
 
Or you can progammatically change the values in the ODBC driver.  This last one, I haven't done personally, but I have seen it done, I don't like it, but it works.
 
CR doesn't care 'where' the data comes from, just that 'looks' like what it expects it to (data schema).



Print Page | Close Window