Database Source Location and VB

hi,

CR9 dev & Visual Basic 6

I want to change the database source location of a CR9 report with VB without change the location in the report file...

Thanks
mystery001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mystery001Author Commented:
In fact, it doesn't help me because the document is for CR8 and CR8.5. But, i've got CR9 and it's not the same methods.

Thanks anyway. :-)
0
mlmccCommented:
What code are you trying to use?

mlmcc
0
mystery001Author Commented:
This is my code
-----------------------------------------------------------
'DECLARATION
Dim UserID As String
Dim Pwd As String
Dim v_seq As String
Dim Source As String
Dim DBsource As String

'Affectation des variables
UserID = "userID"
Pwd = "password"
Base = "baserisc"
v_seq = T_seq.Text
DBsource = "DSN=" & Base & ";;User ID=" & UserID & ";;Password=" & Pwd
   
    'OUVERTURE DU FICHER
    Set CrxRpt = CrxApp.OpenReport("C:\ccm\prc\etats CR\cclt_ess.rpt")

    'CONNEXION BASE DE DONNEE
    CrxRpt.Database.Tables(1).ConnectBufferString = DBsource
   
    'ENVOI DES VALEURS DES PARAMETRES
    CrxRpt.ParameterFields.GetItemByName("v_seq").ClearCurrentValueAndRange
    CrxRpt.ParameterFields.GetItemByName("v_seq").AddCurrentValue v_seq
    CrxRpt.ParameterFields.GetItemByName("indice_langue").ClearCurrentValueAndRange
    CrxRpt.ParameterFields.GetItemByName("indice_langue").AddCurrentValue 20000
    CrxRpt.PaperSize = 155 'us LETTER
   
    F_CRViewer.CRViewer91.ReportSource = CrxRpt 'Définit le fichier à ouvrir dans le contrôle
    F_CRViewer.CRViewer91.ViewReport 'Affiche la rapport
    F_CRViewer.CRViewer91.DisplayGroupTree = False
    F_CRViewer.CRViewer91.Zoom (110)
    F_CRViewer.CRViewer91.DisplayTabs = False
    F_CRViewer.CRViewer91.EnableCloseButton = False
    F_CRViewer.CRViewer91.EnableGroupTree = False
    F_CRViewer.Show

-----------------------------------------------------------

With this method i can connect to my database "baserisc" ("baserisc" being the database set in cclt_ess.rpt).
The problem is that, in my case, i have 4 differents databases (baserisc, baserisd, baserish, baserise) and i want to be able to connect to the differents databases (all the databases have the same structure).
And i don't want to create 4 files with a different database for each file. So, i have to do that in VB !

Thanks to help me. :-)
0
mlmccCommented:
Take a look at

http://support.crystaldecisions.com/communityCS/TechnicalPapers/cr_dbconn_troubleshooting.pdf.asp


http://support.crystaldecisions.com/communityCS/TechnicalPapers/cr_error_detected_by_db_dll.pdf.asp


This may also be useful

CrystalReport.Application.LogOnServer("pdsodbc.dll","DSNNAME", "DBQ=<crwdc>=databasename", "dbusername","dbpassword")

mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.