Solved

Crystal reports login info problem

Posted on 2007-04-09
15
348 Views
Last Modified: 2013-11-07
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
Comment
Question by:yvijayakumar
15 Comments
 
LVL 18

Expert Comment

by:Ajay Sharma
ID: 18880893
0
 
LVL 1

Author Comment

by:yvijayakumar
ID: 18882316
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 18882335
WHat values is it asking for?

What code are you using?

How are you passing parameters to the stored procedures?

mlmcc
0
 
LVL 1

Author Comment

by:yvijayakumar
ID: 18882454
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
 
LVL 1

Author Comment

by:yvijayakumar
ID: 18882468
Other reports designed directly using sp having same issue is solved with sending data as dataset
0
 
LVL 1

Author Comment

by:yvijayakumar
ID: 18882495
Reports designed tables directly is working perfectly. Only the reports connected through sp having the issue.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 100

Expert Comment

by:mlmcc
ID: 18882985
WHere are you passing the parameters?

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

mlmcc
0
 
LVL 1

Author Comment

by:yvijayakumar
ID: 18883054
I am setting the parameters to the reportdocument like this rpDoc.SetParameterValue("ltemDetails", ItemDetails)
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18883242
I don't see it in the code.

mlmcc
0
 
LVL 1

Author Comment

by:yvijayakumar
ID: 18883527
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 18883872
FIrst I have heard that.  I don't see any limitations inthe feature list.

mlmcc
0
 
LVL 1

Author Comment

by:yvijayakumar
ID: 19135070
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
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19311709
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now