Solved

Crystal reports login info problem

Posted on 2007-04-09
15
349 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET bulk update  of a table from another table 4 34
Angular JS Route 3 44
Entity Framework 7 27
Web Form VB.Net  import CSV 4 17
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

937 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

5 Experts available now in Live!

Get 1:1 Help Now