Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

Crystal reports login info problem

I have a report created with crystal reports for vs2005 which includes a subreport. Both report and sub report uses msde 2000 stored procedures as datasources. The report not showing correctly every time it asks values for every formulas in the report. I already used setting login info to the report, but no use. Anybody having a good idea to solve my problem?
0
yvijayakumar
Asked:
yvijayakumar
1 Solution
 
yvijayakumarAuthor Commented:
Check the links, but I didn't get a solution for my problem.

I am using vb.net to develop my application
1. One Main report designed and using a stored procedure to fetch data
2. The main report includes a sub report which is also designed and using another stored procedure
3. The sub report is included in a detail group in the main report and used links to identify data to be fetched from the main report.

I tried setting the LogonInfo for both main and subreport (the code is similar to the code from http://www.codeproject.com/vb/net/CrystalReports_in_VBNET.asp). But when I load the report in crviewer it asks for discrete values.

My actual question is how can I overcome this problem?
0
 
mlmccCommented:
WHat values is it asking for?

What code are you using?

How are you passing parameters to the stored procedures?

mlmcc
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
yvijayakumarAuthor Commented:
E.g.:- rpDoc.SetParameterValue("ltemDetails", ItemDetails)

12 Parameters Date & String datatypes.
I designed the reports directly connecting to the stored procedure.


Public Shared Sub ConnectionSetForReport(ByRef rpDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument, Optional ByVal sqlDataset As Data.DataSet = Nothing)
        Dim strDBCon, strUID, strPWD As String
        strDBCon = DirectCast(dbLib.CacheManager.GetValue("DBcfg"), dbLib.DBServerAccess).ServerName
        strUID = "Admin"
        strPWD = "HighPass"
        strDBCon = dbLib.Support.mWorkstationId
        rpDoc.SetDatabaseLogon(strUID, strPWD, strDBCon, dbLib.Support.mDataSource)
        Call LogonToReport(strDBCon, dbLib.Support.mDataSource, strUID, strPWD, rpDoc, sqlDataset)
    End Sub


Public Shared Sub LogonToReport(ByVal server As String, ByVal database As String, ByVal ID As String, ByVal password As String, ByRef reportDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument, ByVal sqlDataset As Data.DataSet)
        Dim crTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
        Dim table As CrystalDecisions.CrystalReports.Engine.Table

        Dim crSections As CrystalDecisions.CrystalReports.Engine.Sections
        Dim crSection As CrystalDecisions.CrystalReports.Engine.Section

        Dim crSubreportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument
        Dim crReportObjects As CrystalDecisions.CrystalReports.Engine.ReportObjects
        Dim crReportObject As CrystalDecisions.CrystalReports.Engine.ReportObject
        Dim crSubreportObject As CrystalDecisions.CrystalReports.Engine.SubreportObject
        Dim crDataBase As CrystalDecisions.CrystalReports.Engine.Database
        Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables

        Dim crConnectionInfo As CrystalDecisions.Shared.ConnectionInfo


        crDataBase = reportDoc.Database
        crTables = crDataBase.Tables
        crConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo
        crConnectionInfo.ServerName = server
        crConnectionInfo.DatabaseName = database
        crConnectionInfo.UserID = ID
        crConnectionInfo.Password = password

        ' Set the logon information for each table.
        If sqlDataset Is Nothing Then
            For Each table In reportDoc.Database.Tables
                ' Get the TableLogOnInfo object.
                crTableLogOnInfo = table.LogOnInfo
                crTableLogOnInfo.ConnectionInfo = crConnectionInfo
                table.ApplyLogOnInfo(crTableLogOnInfo)
                table.Location = database & ".dbo." & table.Location.Substring(table.Location.LastIndexOf(".") + 1) 'table.Name
            Next table
        Else
            reportDoc.Database.Tables(0).SetDataSource(sqlDataset.Tables(0))
        End If

        crSections = reportDoc.ReportDefinition.Sections
        For Each crSection In crSections
            crReportObjects = crSection.ReportObjects
            For Each crReportObject In crReportObjects
                If crReportObject.Kind = CrystalDecisions.[Shared].ReportObjectKind.SubreportObject Then
                    crSubreportObject = CType(crReportObject, CrystalDecisions.CrystalReports.Engine.SubreportObject)
                    crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
                    crDataBase = crSubreportDocument.Database
                    crTables = crDataBase.Tables
                    For Each table In crTables
                        crTableLogOnInfo = table.LogOnInfo
                        crTableLogOnInfo.ConnectionInfo = crConnectionInfo
                        table.ApplyLogOnInfo(crTableLogOnInfo)
                        table.Location = database & ".dbo." & table.Location.Substring(table.Location.LastIndexOf(".") + 1) 'table.Name
                    Next
                End If
            Next
        Next

    End Sub
0
 
yvijayakumarAuthor Commented:
Other reports designed directly using sp having same issue is solved with sending data as dataset
0
 
yvijayakumarAuthor Commented:
Reports designed tables directly is working perfectly. Only the reports connected through sp having the issue.
0
 
mlmccCommented:
WHere are you passing the parameters?

You have 12 parameters, you are probably being prompted for them.

mlmcc
0
 
yvijayakumarAuthor Commented:
I am setting the parameters to the reportdocument like this rpDoc.SetParameterValue("ltemDetails", ItemDetails)
0
 
mlmccCommented:
I don't see it in the code.

mlmcc
0
 
yvijayakumarAuthor Commented:
Thank you for your prompt support. In the above code the I am not included the parameter assignment etc. Only a sample line of code is included. In my earlier post, I have included the LogOnInfo methods only. I know I am getting the error related to LogOnInfo, but I don't know how to overcome the problem. I asked help in some web forums and my nearest contacts, but the reply is crystal report for vs2005 doesn't support sub reports connected using stored procedures.
0
 
mlmccCommented:
FIrst I have heard that.  I don't see any limitations inthe feature list.

mlmcc
0
 
yvijayakumarAuthor Commented:
I did'nt get an answer for my question. I changed my report design by splitting to 2 piece. Administrator, please close this question. A point refund might be helpful to me
0
 
Computer101Commented:
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Tackle projects and never again get stuck behind a technical roadblock.
Join Now