?
Solved

Problems with changing the connection info of a crystal report in VB.Net using SqlExpress

Posted on 2007-11-21
9
Medium Priority
?
1,155 Views
Last Modified: 2008-02-01
Briefly this is the problem..

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..

So I followed what was at..
http://support.businessobjects.com/library/kbase/articles/c2010275.asp

This however stops at the following line when I run it ...

 crTable.Location = "recycle" & "." & "BLUE\marc" & "." & crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)

it says   FAILED TO LOAD DATABASE INFORMATION
              NO DATABASE dll HAS BEEN SPECIFIED

SOURCE "rptcontrollers.dll"

This is driving me around the bend...

Any help or insight before the weekend begins would be much 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
  • 4
  • 3
9 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 20330772
Are they the same database type?

mlmcc
0
 

Author Comment

by:nomar2
ID: 20332055
I have a " recycle" database sitting on the sql server...maybe I set up the "recycle" database up wong on the SQL EXPRESS.

When you say type ...what exactly do you mean??
0
 

Author Comment

by:nomar2
ID: 20334296
Okay I am looking at it this way ...this is the connection string I am using for the connection into the database and it is working on my form in other words with the click of the button data is being pulled from the database and shown on the screen

Public dsn As String = "Data Source=.\SQLExpress;Database=recycle;trusted_Connection=yes;"

With this string in mind...how would I apply it to the following lines of code...with the exact syntax because it keeps saying..  FAILED TO LOAD DATABASE INFORMATION
                                          NO DATABASE dll has been specified


..so I must be missing something


        For Each crTable In crTables
            With crConnInfo
                .ServerName = servername
                 .DatabaseName = databasename
            End With
            crLogOnInfo = crTable.LogOnInfo
            crLogOnInfo.ConnectionInfo = crConnInfo
            crTable.ApplyLogOnInfo(crLogOnInfo)
        Next

        crTable.Location = databasename & "." & myowner & "." & crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
        crSections = cr2.ReportDefinition.Sections


How would you find out the value for "myowner" in the above line of code??

I will increase the points if I can get this working
0
Independent Software Vendors: 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!

 
LVL 101

Expert Comment

by:mlmcc
ID: 20337003
Type - Are they both SQL Server 7 or is one SQL Server 7 and the other Access.  There may even be a problem with say SQL SERVER xx and SQL Server Express since they may use differnet database drivers or connection methods.

For myowner have you tried dbowner?

mlmcc
0
 

Author Comment

by:nomar2
ID: 20368128
After much toil...I think I came up with the solution..it seems to be working for me ( fingers crossed)
Public dsn As String = "Data Source=.\SQLExpress;Database=recycle;trusted_Connection=yes;"
        Dim cr As New rpt_SortReceipt
        Dim D As Integer
        Dim lcServerName As String = Nothing
        Dim lcDatabase As String = Nothing
        Dim lcTrusted As String
        Dim lbTrusted As Boolean

        If lnMode = 1 Then
            Dim stringItems() As String = dsn.Split(";")
            If stringItems(0) <> "" Then
                If InStr(stringItems(0), "Data Source=", CompareMethod.Text) > 0 Then
                    lcServerName = Mid(stringItems(0), 13)
                End If
            End If
            If stringItems(1) <> "" Then
                If InStr(stringItems(1), "Database=", CompareMethod.Text) > 0 Then
                    lcDatabase = Mid(stringItems(1), 10)
                ElseIf InStr(stringItems(1), "Initial Catalog=", CompareMethod.Text) > 0 Then
                    lcDatabase = Mid(stringItems(1), 17)
                End If
            End If
            If stringItems(2) <> "" Then
                If InStr(stringItems(2), "trusted_Connection=", CompareMethod.Text) > 0 Then
                    lcTrusted = Mid(stringItems(2), 20)
                    If UCase(lcTrusted) = "YES" Then
                        lbTrusted = True
                    ElseIf UCase(lcTrusted) = "NO" Then
                        lbTrusted = False
                    End If
                End If
            End If

            ' MsgBox(lcServerName)
            ' MsgBox(lcDatabase)
            ' MsgBox(lbTrusted)

            cr.DataSourceConnections.Item(0).SetConnection(lcServerName, lcDatabase, lbTrusted)
            ' cr.SetDatabaseLogon("sa", "sa") ' commented out for my case
            cr.RecordSelectionFormula = "{tInv.IID}= " & lnBeginID & ""
            For D = 1 To 1
                cr.SetParameterValue("prm_InvoiceID", D)
                cr.PrintToPrinter(1, False, 0, 0)
            Next

End If
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 20557249
Since the answer is provided, how about PAQ/Refund

mlmcc
0
 

Author Comment

by:nomar2
ID: 20590070
I have been using the above solution and it is working perfectly...
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 20591160
PAQed with points refunded (50)

Computer101
EE Admin
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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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