i have created an application and crystal report using Visual Studio 2005
, the application able to show and print the report in my pc, and working fine.

I also created the setup.exe to deploy the crystal report into other
computer, but when i click the button to generate report,
the Crystal Report Viewer show a Database Login screen everytime.

Please help me out. Thanks.


here is my code.

Code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Web
Imports System.IO
Imports CrystalDecisions.Shared

Public Class frmGLTransaction_listing

    Private con As New Clsappconfiguration
    Private rptsummary As New ReportDocument

    Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click
        'rptsummary.Refresh()
        rptsummary.Load(Application.StartupPath & "\Accounting Reports\gl_transaactionlisting.rpt")
        Logon(rptsummary, con.Server, con.Database, con.Username, "sa")
        rptsummary.Refresh()
        rptsummary.SetParameterValue("@frmMth", cboMth1.SelectedItem)
        rptsummary.SetParameterValue("@toMth", cboMth2.SelectedItem)
        rptsummary.SetParameterValue("@year", cboYear.SelectedItem)
        rptsummary.SetParameterValue("@sortedby", cboSorted.SelectedItem)
        rptsummary.SetParameterValue("@frmAcnt", cboAcnt1.SelectedItem)
        rptsummary.SetParameterValue("@toAcnt", cboAcnt2.SelectedItem)
        rptsummary.SetParameterValue("@fxKeyCompany", gCompanyID())

        Me.crvRpt.Visible = True
        Me.crvRpt.ReportSource = rptsummary
    End Sub

    Function Logon(ByVal cr As ReportDocument, ByVal server As String, ByVal db As String, ByVal id As String, ByVal pass As String) As Boolean
        Dim ci As New ConnectionInfo
        Dim subObj As SubreportObject
        ci.ServerName = server
        ci.DatabaseName = db
        ci.UserID = id
        ci.Password = pass
        If Not (ApplyLogon(cr, ci)) Then
            Return False
        End If
        Dim obj As ReportObject
        For Each obj In cr.ReportDefinition.ReportObjects()
            If (obj.Kind = ReportObjectKind.SubreportObject) Then
                subObj = CType(obj, SubreportObject)
                If Not (ApplyLogon(cr.OpenSubreport(subObj.SubreportName), ci)) Then
                    Return False
                End If
            End If
        Next
        cr.Refresh()
        Return True
    End Function

    Function ApplyLogon(ByVal cr As ReportDocument, ByVal ci As ConnectionInfo) As Boolean
        Dim li As TableLogOnInfo
        Dim tbl As Table
        For Each tbl In cr.Database.Tables
            li = tbl.LogOnInfo
            li.ConnectionInfo = ci
            tbl.ApplyLogOnInfo(li)
            If (tbl.TestConnectivity()) Then
                If (tbl.Location.IndexOf(".") > 0) Then
                    tbl.Location = tbl.Location.Substring(tbl.Location.LastIndexOf(".") + 1)
                Else
                    tbl.Location = tbl.Location
                End If
            Else
                Return False
            End If
        Next
        Return True
    End Function

End Class