Solved

Changing Crystal Report Connection String in VB.Net

Posted on 2007-11-15
2
2,271 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
.NET tools for adding thread safety to a web app? 3 34
VB.NET 2008 (3.5 Framework) Remove all items from List 3 22
Crystal Reports 2013 25 35
VB.Net Report Printing Issue 3 34
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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