Skip to Content
author's profile photo Former Member
Former Member

VS2010, against SQL 2K8 R2 - login failure when adding subreport.

I have tried a number of ways to get this to work. Is there a set of instructions that can be followed to render a CR with a subreport?

I can create CR reports that run. Can create subreports that run, but a CR containing a subreport will not run on the server. Fails with a variety of errors, depending on whether I am using XSDs, OLE-DB or DSN connection. I give up trying different methods and looking all over the internet for fixes.

What is the preferred method of connection? I am using stored procedures, and typically have no prblem with RC, but I have to adwit - this- is the first time that I have tried a subreport.

I just cannot beleive how difficult this is to push into a non-dev environment. Maybe I am missing something simple . . .

Dev: VS2010 on Vista. CR SP1. Server: Win 2K8 R2 Ent, SQL 2K8 R2

Thanks!

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Oct 19, 2011 at 06:40 PM

    Preferably, use the same connection type (ODBC, OLEDB, etc.) for both the main and the subreport. Then you'd want to use code along the lines of:

    
    
    
    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    crReportDocument = New CrystalReport1
    
    CrConnectionInfo = New ConnectionInfo
    With crConnectionInfo
    .ServerName = "dbconn1"
    .DatabaseName = "Pubs"
    .UserID = "vantech"
    .Password = "vantech"
    crDatabase = crReportDocument.Database
    crTables = crDatabase.Tables
    End With
    
    crDatabase = crReportDocument.Database
    crTables = crDatabase.Tables
    For Each crTable In crTables
    crTableLogOnInfo = crTable.LogOnInfo
    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    crTable.ApplyLogOnInfo(crTableLogOnInfo)
    Next
    
    'Log on subreport
    
    crSubreportDocument = crReportDocument.OpenSubreport("Ron")
    
    crConnectionInfo = New ConnectionInfo
    With crConnectionInfo
    .ServerName = "Rcon1"
    .DatabaseName = "Northwind"
    .UserID = "vantech"
    .Password = "vantech"
    End With
    
    crDatabase = crSubreportDocument.Database
    crTables = crDatabase.Tables
    For Each crTable In crTables
    crTableLogOnInfo = crTable.LogOnInfo
    crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    crTable.ApplyLogOnInfo(crTableLogOnInfo)
    Next
    CrystalReportViewer1.ReportSource = crReportDocument
    
    
    

    As you do not provide any code you may have tried, it's hard to give you more than that. If the above does not help, lsettle on a type of connection you want to use and let's proceed from there. As it is (XSDs, OLE-DB or DSN connection) is a bit too expansive(?)...

    Ludek

    Follow us on Twitter http://twitter.com/SAPCRNetSup

    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

    Add a comment
    10|10000 characters needed characters exceeded

    • This post was marked as "Answered". Please create a new Discussion. Add in more info, e.g.; version of CR - be precise (e.g.; CR 12 is not precise), version of .NET. Add more details re.; Over mapped drive.

      This being a mapped driver, consider permission issues. Add the report with saved data to your new Discussion.

      - Ludek

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.