Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Crystal reports login info problem

Posted on 2007-04-09
15
Medium Priority
?
357 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
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 101

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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
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
 
LVL 101

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 101

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 101

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

636 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