Hello,

I have created a report using SAP Crystal Report on Visual Studio 2010. As datasource, a interal dataset is used to populate the report which is included in my project. Everything seems to work fine until during runtime when I load the report onto the report viewer, it keep telling me to end a username and a password when I using a dataset that has no form of security nor authentication.
I've found older posts and tried multiple suggestions but no luck.
I've have posted my codes and what I've tried so far. I would appreciate your help.

my code

Dim myConnection As System.Data.OleDb.OleDbConnection = _
        New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & _
                                              FileLocation & "';Extended Properties=Excel 8.0;")

Private Sub btnSelect_Click(sender As System.Object, e As System.EventArgs) Handles btnSelect.Click
        Dim btnCommand As System.Data.OleDb.OleDbDataAdapter
        Dim cryRpt As New ReportDocument
        Dim rptLocation As String

        rptLocation = Environment.CurrentDirectory & "\pltpaper.rpt"
        'MsgBox(rptLocation)

        btnCommand = New System.Data.OleDb.OleDbDataAdapter("SELECT Index, Model, Control, Serial, PLT FROM [ScanData$] WHERE PLT = '" & cbPallet.SelectedValue & "'", myConnection)

        Try
            GoodDataSet1.GoodTable.Clear()
            btnCommand.Fill(GoodDataSet1.GoodTable)

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        Try
            cryRpt.Load(rptLocation)


            CrystalReportViewer1.ReportSource = cryRpt
            CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.IntegratedSecurity = True

            'cryRpt.DataSourceConnections(0).SetConnection(Environment.CurrentDirectory, "", False)
            CrystalReportViewer1.Refresh()

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

Suggested Solution that I've tried so far

            CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.IntegratedSecurity = True

            cryRpt.DataSourceConnections(0).SetConnection(Environment.CurrentDirectory, "", False)

Recommended Answers

All 2 Replies

Hi ,

Have you tried setting integrated security to false and supplying a blank password and username value in your connection?

Hey G.
Thank you for your help. I added following codes but still not working. Please tell me if the codes below is right. Thanks

            myConnectionInfo.DatabaseName = "GoodDataSet"
            myConnectionInfo.UserID = ""
            myConnectionInfo.Password = ""
            CrystalReportViewer1.LogOnInfo(0).ConnectionInfo = myConnectionInfo
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.