Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 3rd, 2003, 06:57 AM
Registered User
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Logon Problem using Crystal Report and Asp.net ???

Hi all,
I want to create a crystal report using asp.net running on my Local PC... I have add a physical crystal report into my .net project and
can connect to the my local SQL Server - Northwind Database and drag-N-drop the "Customers" Table's fields to the crystal report.

-My setting-
sql server: using sql and window authentication, use "sa" as username and "password" as password.

However, when I run the code, I receive an error message "Logon Failed"... and my code is shown as below:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Put user code to initialize the page here
        Dim crTableLogoninfos As New TableLogOnInfos
        Dim crTableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As ConnectionInfo
        Dim crReportDocument As New testRpt

        crTableLogoninfos = New TableLogOnInfos
        crTableLogoninfo = New TableLogOnInfo
        crConnectionInfo = New ConnectionInfo
        With crConnectionInfo
            .ServerName = "MyComputerName"
            .DatabaseName = "NorthWind"
            .UserID = "sa"
            .Password = "password"
        End With

        crTableLogoninfo.ConnectionInfo = crConnectionInfo
        crTableLogoninfos.Add(crTableLogoninfo)
        CrystalReportViewer1.LogOnInfo = crTableLogoninfos
        CrystalReportViewer1.ReportSource = crReportDocument

        CrystalReportViewer1.DataBind()
End Sub

Anyone have an idea what's wrong ?

Regards,
Charles.


 
Old January 4th, 2004, 05:48 PM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have the same problem :(

 
Old December 4th, 2004, 02:47 AM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have the same problem.

 
Old December 7th, 2004, 02:09 AM
Registered User
 
Join Date: Jul 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Srikanth_nd Send a message via Yahoo to Srikanth_nd
Default

Hi PPl,

Earlier I had the same problem. But I think the reason why its givin failed to logon is ...its not able to take the logon credentials for the table as I see in the above posted code. This is what I am using and its working fine. Try making changes a the below mentioned code. This bug is actually fixed in the Framework 1.1 and 2.0 .

***********CODE*****************

Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here

        sCode = Request.QueryString("CODE")

        InitializeComponent()
        Dim SelectFormula As String
        SelectFormula = "{WMS_M_SCRIPT.SCRIPT_CD} = '" & sCode & "'"

        CrystalReportViewer1.SelectionFormula = SelectFormula

        crConnectionInfo.ServerName = "SYSADMIN02"
        crConnectionInfo.DatabaseName = "testing"
        crConnectionInfo.UserID = "sa"
        crConnectionInfo.Password = ""
        crDatabase = crReportDocument.Database
        crTables = crDatabase.Tables

        For Each crTable In crTables

            crTableLogOnInfo = crTable.LogOnInfo
            crTableLogOnInfo.ConnectionInfo = crConnectionInfo
            crTable.ApplyLogOnInfo(crTableLogOnInfo)

        Next

        CrystalReportViewer1.ReportSource = crReportDocument

        CrystalReportViewer1.PageZoomFactor = 100

        CrystalReportViewer1.Visible = True


    End Sub

************************************************

The above code applies the Logon Credentials for each table exclusively if there is more than one table.

Cheer........

 
Old December 12th, 2004, 02:36 PM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

make sure you create a Setup & Deploment project to your solution so you can run it on the server. This registers Crystal, the merge modules, and the licensing file to the server. Without this stuff, it will never run.

I spent weeks researching this and found an article that explains it.

[http://support.businessobjects.com/c..._printing.pdf]



 
Old December 12th, 2004, 02:47 PM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is the article you really need.

http://support.businessobjects.com/c...deployment.pdf

Ron

 
Old December 29th, 2004, 03:41 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to abhishek_255 Send a message via Yahoo to abhishek_255
Default

By adding a single line marked as red u can solve the problem

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Put user code to initialize the page here
        Dim crTableLogoninfos As New TableLogOnInfos
        Dim crTableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As ConnectionInfo
        Dim crReportDocument As New testRpt

        crTableLogoninfos = New TableLogOnInfos
        crTableLogoninfo = New TableLogOnInfo
        crConnectionInfo = New ConnectionInfo
        With crConnectionInfo
            .ServerName = "MyComputerName"
            .DatabaseName = "NorthWind"
            .UserID = "sa"
            .Password = "password"
        End With

        crTableLogoninfo.ConnectionInfo = crConnectionInfo
 crTableLogoninfo.TableName = "Place your table name Here"
        crTableLogoninfos.Add(crTableLogoninfo)
        CrystalReportViewer1.LogOnInfo = crTableLogoninfos
        CrystalReportViewer1.ReportSource = crReportDocument

        CrystalReportViewer1.DataBind()
End Sub

Abhishek
[email protected]


 
Old January 6th, 2005, 02:52 PM
Registered User
 
Join Date: Jan 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Trevor Miles
Default

Folks, I am running in to a very similar problem. Since I have many users that require only a small portion of the data available, I chose to first load their specific data into a dataset. This code works fine in a WinApp, but fails with the "Logon Failed" error message mentioned when I drop the code into a WebApp. I'm not providing any LogonInfo beacuse I am linking to the dataset. What am I missing? I have stepped through and only get the error when I associate the CR with the CRV. If I need logon credentials, what do I use? I've already extracted the data from the DB.


   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not (Me.IsPostBack) Then
            Session("iRec") = 0

            AgentID = Page.Request.QueryString("AID")
            RequirementID = CType(Page.Request.QueryString("RID"), Date)

            With sqlSelectResponseDetailView.Parameters
                .Item("@AgentID").Value = AgentID
                .Item("@RequirementID").Value = RequirementID
            End With
            sdaResponseDetailView.Fill(DsResponses1, "ResponseDetailView")
            dv = New DataView(DsResponses1.ResponseDetailView)

            crResponses1.SetDataSource(DsResponses1.ResponseDe tailView)
            crvResponses.ReportSource = crResponses1
            crvResponses.DataBind()
        End If

    End Sub


 
Old January 13th, 2005, 11:41 AM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

' Define Crystal Reports variable
        Dim crReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocum ent
        Dim crExportOptions As CrystalDecisions.Shared.ExportOptions
        Dim crDiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
        Dim Fname As String



        crReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocum ent

        crReportDocument.Load("C:\inetpub\wwwroot\test.rpt ")

        Fname = "c:\temp\" & Session.SessionID.ToString & ".pdf"
        crDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
        crDiskFileDestinationOptions.DiskFileName = Fname
        crExportOptions = crReportDocument.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskFileDestinationOptions
            .ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.Disk File
            .ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableD ocFormat
        End With

        Dim table As New DataTable
        Dim adaptador As New SqlClient.SqlDataAdapter
        Dim con As New SqlClient.SqlConnection
        con.ConnectionString = ConfigurationSettings.AppSettings("ConnectionStrin g")
        Dim cmd As New SqlClient.SqlCommand("select * from table", con)
        adaptador.SelectCommand = cmd
        adaptador.Fill(tabla)
        crReportDocument.SetDataSource(tabla)
        CrystalReportViewer1.ReportSource = crReportDocument
        CrystalReportViewer1.DisplayGroupTree = True

        CrystalReportViewer1.DataBind()
        crReportDocument.Export() ' if i want to export it to a file, in this example to a pdf

 
Old March 6th, 2005, 11:01 PM
Registered User
 
Join Date: Mar 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much!
This is very useful for me!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Database logon problem with Crystal Report jaucourt Crystal Reports 6 September 25th, 2009 11:39 AM
Crystal Report problem in ASP.Net aliirfan84 ASP.NET 2.0 Professional 0 July 11th, 2007 02:11 AM
Crystal Report Problem with ASP.Net 2.0 aliirfan84 ASP.NET 2.0 Professional 1 June 17th, 2007 01:39 AM
Problem in using Crystal report with asp.net sKavita ASP.NET 1.0 and 1.1 Professional 0 November 7th, 2006 02:48 AM
Logon Fail in Crtystal Report with ASP.Net charles Crystal Reports 0 October 1st, 2003 10:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.