p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

crystal_reports thread: Cannot Dynamically change ODBC datasource..


Message #1 by "chakrapani" <chakri_muriki@y...> on Wed, 12 Dec 2001 07:25:44
Hi,

 I am using VB6 and Segate Crystal Reports 7 and Access 2000 and I used 

crystal report activeX control(CRYSTL32.OCX) and I have used ODBC 

Connectivity.



I have designed many reports with a database using ODBC Connectivity.

But,I need to change the name the DSN at runtime.Eventhough I set connect 

string dynamically to the report.it is displaying the data of database 

which was used during design time of report only.But It never connects to 

other database(ofcourse the databases are identical)and executing the data 

of older report only.



The report has following code:Here "CryRpt" is the report control



#################

CryRpt.Reset

CryRpt.DiscardSavedData = True

CryRpt.Connect = sConnect

CryRpt.ReportFileName = G_ReportPath & "Progress.Rpt"

CryRpt.WindowState = crptMaximized

CryRpt.Action = 1

####################

Here sConnect is ODBC connect string



But it never connects.Please anybody can tell me how to achieve my task



Thanks

Message #2 by "Preethi" <preethi@s...> on Thu, 13 Dec 2001 12:36:57 +0600
on the SQL Query of the report whether servername, database name etc are

mesioned



Example: Select EmpCode From SoftServer.Soft.dbo.Emplyee

                change it to Select EmpCode From Employee





Preethi

----- Original Message -----

From: "chakrapani" <chakri_muriki@y...>

To: "crystal_reports" <crystal_reports@p...>

Sent: Wednesday, December 12, 2001 7:25 AM

Subject: [crystal_reports] Cannot Dynamically change ODBC datasource..





Check > Hi,

>  I am using VB6 and Segate Crystal Reports 7 and Access 2000 and I used

> crystal report activeX control(CRYSTL32.OCX) and I have used ODBC

> Connectivity.

>

> I have designed many reports with a database using ODBC Connectivity.

> But,I need to change the name the DSN at runtime.Eventhough I set connect

> string dynamically to the report.it is displaying the data of database

> which was used during design time of report only.But It never connects to

> other database(ofcourse the databases are identical)and executing the data

> of older report only.

>

> The report has following code:Here "CryRpt" is the report control

>

> #################

> CryRpt.Reset

> CryRpt.DiscardSavedData = True

> CryRpt.Connect = sConnect

> CryRpt.ReportFileName = G_ReportPath & "Progress.Rpt"

> CryRpt.WindowState = crptMaximized

> CryRpt.Action = 1

> ####################

> Here sConnect is ODBC connect string

>

> But it never connects.Please anybody can tell me how to achieve my task

>

> Thanks

>




$subst('Email.Unsub').



Message #3 by "Yama Kamyar" <y.kamyar@e...> on Thu, 13 Dec 2001 12:39:02 -0800
Hi,



What does your sConnect look like?



sConnect = "UID=Crystal;PWD=Report;DSN=YAMAHA"



Of course my sConnect is fictional but supposedly I create the DSN going to the ODBC screen.



On Win 2000: Go to "Administrative Tools" and choose "Data Sources (ODBC)" then setup your ODBC appropriately.



You should also try to force a Refresh of you control.



Yama Kamyar

Sr. Software Engineer



--



On Wed, 12 Dec 2001 07:25:44   chakrapani wrote:

>Hi,

> I am using VB6 and Segate Crystal Reports 7 and Access 2000 and I used 

>crystal report activeX control(CRYSTL32.OCX) and I have used ODBC 

>Connectivity.

>

>I have designed many reports with a database using ODBC Connectivity.

>But,I need to change the name the DSN at runtime.Eventhough I set connect 

>string dynamically to the report.it is displaying the data of database 

>which was used during design time of report only.But It never connects to 

>other database(ofcourse the databases are identical)and executing the data 

>of older report only.

>

>The report has following code:Here "CryRpt" is the report control

>

>#################

>CryRpt.Reset

>CryRpt.DiscardSavedData = True

>CryRpt.Connect = sConnect

>CryRpt.ReportFileName = G_ReportPath & "Progress.Rpt"

>CryRpt.WindowState = crptMaximized

>CryRpt.Action = 1

>####################

>Here sConnect is ODBC connect string

>

>But it never connects.Please anybody can tell me how to achieve my task

>

>Thanks

>




>





Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com


  Return to Index