Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: problem with setting use dsn default properties Post Reply Post New Topic
Author Message
ishan
Newbie
Newbie
Avatar

Joined: 16 Dec 2008
Location: Nepal
Online Status: Offline
Posts: 19
Quote ishan Replybullet Topic: problem with setting use dsn default properties
    Posted: 22 Oct 2009 at 12:47am
Crystal report 9.0
Visual basic 6.0
Database Oracle 8i

I have an application which uses crystal report 9.0 to preview data. I have created a view in oracle which uses grouping to sum the value. for example:
create or replace view myView as select id, sum(case when type in (1,2,3) then amount else 0 end) as type1amount,sum(case when type in (4,5,6) then amount else 0 end) as type2amount from mytable

I have used this view and another master table to create a report.

The problem is when i try to view the report in crystal report viewer in my application, the report doesn't show the amount with decimal even if the table contains the amount with decimal.

my ado connection string in application is
"dsn=UserDSN ;UID=UserName;pwd=UserPassword"

I have created an instance of CRAXDDRT.Application and named it as crApp
then
logged on to crystal report as
crApp.logonserver "P2SODBC.dll", UDSN, "", UName, UPasswd



At the time of previewing the report I do as follows:
dim crReport as Report

set CrReport=CrApp.OpenReport(App.Path & "myreport.rpt")
CRViewer91.reportsource=crReport
crViewer91.viewReport



Is there any problem with the way i have done it.

By the way I have used Microsoft ODBC which seems to be the problem. So when I use Oracle ODBC everything is fine.
When I opened the report in crystal report 10.0 and looked database properties in set Datasource Location, I found out that another property called "Use DSN Default Properties" set to false. As far as I have found out I need to set this property into the report. So i tride to do like this:

With CrReport.Database
For i = 1 To .Tables.count
Set ConnectionInfo = CrReport.Database.Tables(i).ConnectionProperties
ConnectionInfo.Item("DSN") = "mydsn"
ConnectionInfo.Item("User ID") = "userid"
ConnectionInfo.Item("Password") = "password"
ConnectionInfo.Item("Use DSN Default Properties") = false

Next i

But the line numbers 7 doesn't execute and show error something like this:
"the object invoked has disconnected from its client"

I need to stick to the Microsoft ODBC coz most of my client machines have been setup with Microsoft ODBC.

Can anyone help me out here plz..........
Ishwor
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Oct 2009 at 6:15am
change your machines to use the oracle odbc...if it works and Microsoft doesn't...
IP IP Logged
ishan
Newbie
Newbie
Avatar

Joined: 16 Dec 2008
Location: Nepal
Online Status: Offline
Posts: 19
Quote ishan Replybullet Posted: 22 Oct 2009 at 9:52pm
well i already have that solution.
But I cant go and visit all of my clients and keep changing odbc.
I just want to set "Use Dsn Default Properties" connection properties to false in the given scenario.

I tried to use that properties but it shows this error.

-2147417848     Method 'Value' of object 'IConnectionProperty' failed

Is there anybody to help me out here. My question may not be related to this forum but still i wonder if anybody who knows vb6, crystal report and oracle could help me out here.

Thank you in advance.
Ishwor
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Oct 2009 at 6:15am
I am going to guess that the issue is the ODBC connection.  From what I know, and I'm not an expert, the connection translates between what CR is asking what it gets back from the Database.  If you are speaking the wrong dialect/accent, you will get back gibberish at times.
 
Your clients should change the ODBC connection, if they have Oracle backends, they should have set up the connection to Oracle, otherwise, they should expect things to not work.
 
It would seem that what you want to do, isn't going to work.  Send out step by step instruction to your clients to change the ODBC, it's what 5 minutes or less, and if they don't have correct, send that too.
 
The starting point is that the wrong ODBC connection is being used, fix that instead of trying to work around something programmatically that isn't doing what you want....or have your application get the data from the DB, and push it to the report via XML and don't even worry about the OBDC connection...
 
Another way of saying this, is have you application supply the data to the report, instead of having the report get the data from the database.  This is what my company does, and we don't have the headache of ODBC drivers and their configuration or multiple users or any database/report interactions, because we control the data, not the report.
IP IP Logged
ishan
Newbie
Newbie
Avatar

Joined: 16 Dec 2008
Location: Nepal
Online Status: Offline
Posts: 19
Quote ishan Replybullet Posted: 26 Oct 2009 at 9:29pm
Well I guess I simply add the columns in table and store the values by doing any needful calculation as in view.
I don't have any other way than that. It's the simplest i can do than to supply the data to report or changing odbc.
I don't want anything in my application that is odbc specific.
Using other method such as supplying data to the report is quite tedious coz' i might need to do the calculation in most other reports as well.
Any way THANKS for the suggestion.
I really appreciate that.
Ishwor
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.