How To Connect Two Database Connection In Crystal Reports

Started by VelMurugan, Jun 25, 2008, 09:56 PM

previous topic - next topic
Go Down

VelMurugan

Hi [You],

Currently Am working in report modules.

In that module, i am using multiple database. I want to connect Two database in my reports. At runtime i will change the databases according to the reports.

Help me, How to connect two databases in reports at runtime.

Front End : VB.Net 2005
Back End : Sql Server 2005

Help Me.....................

Kalyan

#1
Jun 25, 2008, 10:23 PM Last Edit: Jun 26, 2008, 12:00 AM by Kalyan
Dear Velu,

I was searching some information from the crystal report support site.

before go that article, check the solution which i give below...

make it use according to your project / product

And I found this article,

http://support.crystaldecisions.com/library/kbase/articles/c2007089.asp

With the same idea, is it mean that there is no way to access two or
more databases from a singal crystal report template?

so, am not sure, try to implement...

to make 2 diff connection to call two database.. i don't how u develop the source, if u tell that the way of source code, i ill help u sure...

check this...

Code: [Select]
CrystalReport1.LogonInfo(0) = "dsn=DB1; uid=ID; pwd=password"
CrystalReport1.LogonInfo(1) = "dsn=DB2"
CrystalReport1.ReportFileName = "1.rpt"


another method:

and one more thing if it possbile use 2 different database to call in single report.


If u have a report template "itacumens.rpt" requires data from 2 different databases, MSSQL and MSAccess. When u make the connect
individually on each database, they both work very well. However, it isn't make sense to me that I can make 2 connections in the same
CrystalReport object.

Are there any methods to handle this sort of situation? try this code..

Code: [Select]
Private Sub Command1_Click()
   With CrystalReport1
       
       '* works with SQL server *
     .Connect = "dsn=myLocalSQLDB;uid=myID;pwd=myPassword"    'works
     '.ReportFileName = "C:\Report_SqlSers.rpt"               'works
       
       '* works with MSAccess *
     .Connect = "dsn=myLocalAccessDB"                         'works
     '.ReportFileName = "C:\Report_MSAccess.rpt"              'works
       
       '/* Both */
     .ReportFileName = "C:\Report_both.rpt" 
       'with runtime error, due to re-assign value as the
       'parameter to the connection, I believe?
       
     .WindowHeight = 600
     .WindowWidth = 800
     .Action = 1
       
End With     
End Sub

VelMurugan

Hi Kalyan,

Thanks For ur Help. I Will Try this way and check it And message you later.

Once Again, I Thank You

ganeshbala

Hi Vel

  Check this...
  But i dont know how it works

  try It ..

 
Code: [Select]
Me.CrystalReportViewer.LogOnInfo.Item(0).ConnectionInfo.ServerName = "MY-COMP"
Me.CrystalReportViewer.LogOnInfo.Item(0).ConnectionInfo.DatabaseName = "NetMania"
Me.CrystalReportViewer.LogOnInfo.Item(0).ConnectionInfo.UserID = "sa"
Me.CrystalReportViewer.LogOnInfo.Item(0).ConnectionInfo.Password = "xxxxxx"


[blink]reference site[/blink]
http://forums.devx.com/showthread.php?t=57193

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens | GinGly :: SMS Backup | Acumen :: Discussion Board | AshokPillar :: Hosting | CineBuzz :: Latest Cinema News | My Kids Diary :: Capture your kids magical moment
Copyright 2005 - 2017 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 10 years - Powered by HostGator Dedicated Server