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 April 12th, 2005, 04:09 PM
Registered User
 
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Guys,

I have tried your suggestions, but still couldn't solve the issue: DATABASE LOGON FAIL. I created a Crystal Report in ASP.NET and used VB.NET to export this report to PDF. I got "Database Logon Fail" error when attempt to exporting... I work with Access Database & did check Database and directory's permission, but still couldn't solve my problem. Would you guys please help! I am not sure what's going on since some other developers look at my code and they said, it should work!!! But somehow it didn't!!!!!...


Many thanks in advance for your help.
--Iris

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

Public Class generateCRpt
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents exportPDF As System.Web.UI.WebControls.Button
    Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    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()
    End Sub

#End Region
    Dim rpt As New CrystalReport

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim intID = Server.UrlDecode(Request.QueryString("nintid"))

        If Page.IsPostBack = False Then
            'Response.Write("<br>")
            'Response.Write("Qstring = " & intID)
            'Response.Write("<br>")
        Else
            'Response.Write("goofy you")
        End If


        'Dim myConnection As OleDbConnection
        Dim myCommand As New OleDbCommand
        Dim myDA As New OleDbDataAdapter
        Dim myDS As New Dataset1

        'Try

        Dim strCnn As String = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Inetpub\wwwroot\InterviewPacketCrystalRe port\CUSTOMER.mdb;"
        Dim myConnection As New OleDbConnection(strCnn)
        myCommand.Connection = myConnection
        'myCommand.CommandText = "SELECT * FROM tblInterviewCR WHERE IntCR_ID =" & intID ' put back when done
        myCommand.CommandText = "SELECT * FROM tblInterviewCR WHERE IntCR_ID =" & 47
        'myCommand.CommandText = "SELECT * FROM tblInterviewCR"
        myCommand.CommandType = CommandType.Text
        myDA.SelectCommand = myCommand

        myDA.Fill(myDS, "tblInterviewCR")
        rpt.SetDataSource(myDS)
        CrystalReportViewer1.ReportSource = rpt

        'Catch ex As Exception
        'Response.Write("There is a technical problem occurred during your building process. Please contact Training Developement for further information.")
        'End Try
    End Sub

    Sub ExportToPDF(ByVal sender As System.Object, ByVal e As System.EventArgs)

        '*** start Login Fail
        rpt = New CrystalReport
        Dim crTableLogoninfos As New TableLogOnInfos
        Dim crTableLogoninfo As New TableLogOnInfo
        Dim crConnectionInfo As ConnectionInfo

        crTableLogoninfos = New TableLogOnInfos
        crTableLogoninfo = New TableLogOnInfo
        crConnectionInfo = New ConnectionInfo
        With crConnectionInfo
            .ServerName = "X00E490"
            .DatabaseName = "CUSTOMER"
            .UserID = "Admin"
            .Password = ""
        End With

        crTableLogoninfo.ConnectionInfo = crConnectionInfo
        crTableLogoninfo.TableName = "tblInterviewCR"
        crTableLogoninfos.Add(crTableLogoninfo)
        CrystalReportViewer1.LogOnInfo = crTableLogoninfos
        CrystalReportViewer1.ReportSource = rpt

        'CrystalReportViewer1.DataBind()

        '*** end Login Fail

        Dim crReportDocument As ReportDocument
        crReportDocument = New ReportDocument

        'Load crystal report for ready to export
        crReportDocument.Load("C:\Inetpub\wwwroot\Intervie wPacketCrystalReport\CrystalReport.rpt")


        'CrystalReportViewer1.ReportSource = crReportDocument
        'Dim crExportOptions As ExportOptions
        Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
        Dim ExportPath As String
        Dim ExportedFileName As String

        ExportPath = Request.PhysicalApplicationPath + "ExportDir\"

        ' check for exporting directory, if it's not exist then create one
        If Directory.Exists(ExportPath) = False Then
            ' PhysicalApplicationPath is http://localhost/CrystalReport/
            Directory.CreateDirectory(Request.PhysicalApplicat ionPath + "ExportDir\")
        End If

        crDiskFileDestinationOptions = New DiskFileDestinationOptions
        'crExportOptions = crReportDocument.ExportOptions


        ' exporting to PDF
        ExportedFileName = "CrystalReport.rpt.pdf"
        crDiskFileDestinationOptions.DiskFileName = ExportPath + "CrystalReport.rpt.pdf"
        With crReportDocument.ExportOptions
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
            .DestinationOptions = crDiskFileDestinationOptions
        End With


        Try
            ' using Export() method
            crReportDocument.Export()
            Response.Write("")
            Response.Write("<a href=ExportDir/" + ExportedFileName + ">Click here to View Exported Report</a>")
            Response.Write("")
        Catch err As OutOfLicenseException
            Response.Write("<br>")
            Response.Write("<b style:font-color=red>Server Busy, Please Try Later. <br />OR <br />Contact System Administrator.</b>")
        Catch err1 As Exception
            Response.Write("<br>")
            Response.Write(err1.Message.ToString)
        End Try
    End Sub

End Class

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



 
Old April 14th, 2005, 04:33 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm recieving a similar kind of problem but in VB.net...Actually i have used crystal reports that are embedded with VS.net, and i use them as embedded resource..when i run my application on my machine it runs fine..but as soon as i deploy it on client machine..my report doen't load itself..this problem is also faced even if i change the location of my exe file on the local machine as well..note that i've added the merge modules that are required for crystal reports...may be the reason be that when i add database fields with drag and drop the local source path of the database becomes attached to the crystal reports path...see if anybody can help...
 
Old May 12th, 2005, 11:07 AM
Registered User
 
Join Date: May 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have a web page that the user creates a Crystal Report based on the selections they make on the web page.

I have the Crystal Report pulling the data from a dataset, then creating a pdf file.

It works great on my test machine, but when I move it to the web server, I get this error message;

Server Error in '/' Application.
--------------------------------------------------------------------------------

Method not found: System.IO.Stream CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToStream(CrystalDecisions.Shared.ExportF ormatType).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: System.IO.Stream CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToStream(CrystalDecisions.Shared.ExportF ormatType).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[MissingMethodException: Method not found: System.IO.Stream CrystalDecisions.CrystalReports.Engine.ReportDocum ent.ExportToStream(CrystalDecisions.Shared.ExportF ormatType).]
WorldProjects.SSAB.Button1_Click(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Here is part of the code I am using;

Imports System.IO 'this is at the top of the page


'Below is cut out of a Private Sub

Dim SelectedCons As String = ""
For Each Itm In CheckBoxList1.Items
If Itm.Selected = True Then
SelectedCons &= "'" & RTrim(Itm.ToString) & "',"
End If
Next
SelectedCons = SelectedCons.Substring(0, SelectedCons.LastIndexOf(","))

'Get data
Dim SqlStr As String

SqlStr = "Select * " & _
"From View_Report02 " & _
"where ShipID=" & ShipID & " AND Destination IN(" & SelectedCons & _
") "

If Dropdownlist3.SelectedItem.ToString <> "" Then
If Dropdownlist3.SelectedItem.ToString <> "--Select All--" Then
SqlStr &= " AND ArrvlPort='" & ArrvlPort & "' "
End If
End If
SqlStr &= "Order by Destination asc,LoadID desc,MPalletID;"

'Create Dataset
Dim SqlDA As New SqlDataAdapter(SqlStr, SqlCon)
SqlCon.Open()
SqlDA.Fill(DatasetRpt1, "View_Report02")

'DatasetRpt1.WriteXml("testdata.xml")
'DatasetRpt1.WriteXmlSchema("testSchema.xml")

SqlCon.Close()

'Populate the report
Dim Rep As Report1
Rep = New Report1()
Rep.SetDataSource(DatasetRpt1)
CrystalReportViewer1.ReportSource = Rep

' Creating the PDF file
Dim oStream As New MemoryStream() ' // using System.IO
' oStream = (MemoryStream)
oStream = Rep.ExportToStream(CrystalDecisions.Shared.ExportF ormatType.PortableDocFormat)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.BinaryWrite(oStream.ToArray())
Response.End()


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I am guessing I need to install something on the webserver that has to do with SQLXML. I did install the SQLXML 3.0 and Soap Toolkit 3.0 on the webserver, but that didn't work (I did not reboot after the install because that server is being used by my users)

Thank you for any help.

Robert

RobertEB
 
Old March 1st, 2007, 02:49 PM
Registered User
 
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I ran into similiar problems ... Look at this guide and see if it helps any:

http://www.instantcrystal.net/instantguide.aspx






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.