Solved

Changing Crystal Report Connection String in VB.Net

Posted on 2007-11-15
2
2,273 Views
Last Modified: 2012-08-13
I have a module in A VB.Net called Globals in there I have 2 connection strings

Public dsn1 As String = "Data Source=192.168.999.99;Initial Catalog=recycle;Persist Security Info=True;User ID=sa;Password=sa;"
    'Public dsn2 As String = "Data Source=.\SQLExpress;Database=recycle;Uid=11;Pwd=11;" 'Single System

I first connection string  is working fine and with the click of the buttons on my forms my codes runs fine and it reads the database fine..

The problem is I had to create a crystal report...so I used the report wizard.In the database expert I picked the name of the database from the list of connections in the database expert, I chose the database which was represented in my globals as dsn1.

This works fine....

The problem is if I wanted the same report  to read the data that was represented by the database for dsn2... How would I do this the 2 databases are identical...except they are in 2 separates places..

This is  the call that fires the crystal report....

  cr.SetDatabaseLogon("11", "11")
         
  Dim CrTables As Tables
  Dim CrTable As Table

   CrTables = cr.Database.Tables

        For Each CrTable In CrTables
             CrTable.Location = dsn2
         Next

            cr.RecordSelectionFormula = "{tInv.IID}= " & lnBeginID & ""
            For D = 1 To 1
                cr.SetParameterValue("prm_InvoiceID", D)
                cr.PrintToPrinter(1, False, 0, 0)
            Next

Any help or insight would be greatly appreciated...

0
Comment
Question by:nomar2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 20290302
Check thi slink for how to pass logon information
http://support.businessobjects.com/library/kbase/articles/c2010275.asp

mlmcc
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 120 total points
ID: 20290314
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with error in Query 2 38
division by zero in crystal reports 1 25
How can I add google maps in vb.net. 2 14
Web page design problem 3 12
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question