Md Mushtaque

Md Mushtaque

  • NA
  • 25
  • 0

VS2005, Crystal Report 2008 and Oracle 10g

Aug 6 2008 2:52 AM

Hi Programmers and Developers

I am using VS2005, Oracle 10g and Crystal Report 2008. As I am new to Crystal Report and this is my first time creating reports and this is my new job. I am in probationary period. The report's preview is fine. While running from web server or local server it prompts for Database password. If once the password is given it views the report nicely and next time it does not asks for it. I could not understand the reason of prompting for Password where it has already been set in the code. I checked the code snippet by step by step run it is executing without any error. I would like to know that how this promting part could be ommitted or for the first time I have to give the password to it? Kindly reply at your earliest as I am doing a project whose dead line is just after 10 days.

My email id is [email protected]

Thanks for your effort.

With regards

Md. Mushtaque

My code snippet is as follows:

Sub setDBConnection(ByVal rName As String)

        Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
        Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim dbConn As TableLogOnInfo = New TableLogOnInfo
        Dim oRpt As ReportDocument = New ReportDocument
        Dim arrTables As Object() = New Object(0) {}
        ReDim arrTables(2)
        oRpt.Load(rName)
        crDatabase = oRpt.Database
        crDatabase.Tables.CopyTo(arrTables, 0)

        crTable = DirectCast(arrTables(0), CrystalDecisions.CrystalReports.Engine.Table)
        dbConn = crTable.LogOnInfo
        dbConn.ConnectionInfo.DatabaseName = "MyDatabase"
        dbConn.ConnectionInfo.ServerName = "MyServer"
        dbConn.ConnectionInfo.UserID = "MyUser"
        dbConn.ConnectionInfo.Password = "MyPwd"
        crTable.ApplyLogOnInfo(dbConn)

        myCrystalReportViewer.ReportSource = oRpt
    End Sub