cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports not using database logon info

Former Member
0 Kudos

I am using VS 2010 SP1 with SQL Server 2008 R2 and Crystal Reports for VS 2010. I'm having a problem that just started occurring recently. On one of my reports, when I load it up, it sends me to the Database Logon screen. The thing is that I've already given the database logon information in the code, so as to prevent this screen. It was working until recently, and now 80% of the time that a client machine tries to go to this report, the screen appears. If I try to put the SQL Login information in, it won't allow it unless I uncheck integrated security, and then it will go to the report. I have no clue what would cause this. My coding for the button that opens the report page is this:

    Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click

        Dim frm As frmReports = New frmReports

        Dim crysRepo As New crExpense

        With frm.CrystalReportViewer1

            .ReportSource = crysRepo

            .ShowGroupTreeButton = False

            .ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None

        End With

        crysRepo.SetDatabaseLogon("jangel", "jangel")

        crysRepo.SetParameterValue("EXP_NumP", Me.ComboBox1.Text)

        frm.Button1.Visible = True

        frm.Text = "SRB Expense Sheet (Print)"

        frm.expNum = ComboBox1.Text

        frm.Show()

    End Sub

I'm posting this on this forum, and one of the forums on MSDN hoping that one will be able to give me the answer I need. 

View Entire Topic
former_member188030
Active Contributor
0 Kudos

Hi,

Try the sample app 'DB Logon ' from below link.

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/5050d3d0-19dd-2d10-ffb2-ddcd30a3e655&override...

See if it helps,

- Bhushan.

former_member183750
Active Contributor
0 Kudos

I agree wiht Bhushan that you should be using the ApplyLogonInfo API. SetDatabaseLogon will only work on datasources that are exactly the same as what the report was created off of. Also, recommend you update to SP3:

http://scn.sap.com/docs/DOC-7824

- Ludek