Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Error in Crystal reports - vb.net. "Logon Failed" Post Reply Post New Topic
Author Message
yasinirshad
Newbie
Newbie
Avatar

Joined: 24 Sep 2007
Location: Saudi Arabia
Online Status: Offline
Posts: 39
Quote yasinirshad Replybullet Topic: Error in Crystal reports - vb.net. "Logon Failed"
    Posted: 04 Oct 2007 at 2:43am
Hi,
Help me resolve this error : "Logon Failed."
Error here:
crReportDocument.Export()

Code:
Private Sub Btn_Export_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Export.Click
        Try
            Dim ConnInfo As New ConnectionInfo
            With ConnInfo
                .ServerName = "WASA00150"
                .DatabaseName = "iCalls"
                .UserID = "sa"
                .Password = "courage"
            End With
            Me.CrystalReportViewer1.ParameterFieldInfo.Clear()
            Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
            Dim crParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
            If Me.txtSTdate.Text.Trim.Length > 0 Then
                Me.CrystalReportViewer1.ReportSource = Server.MapPath("iCalls_CrystalReport_Department.rpt")
                Dim crDataDef As DataDefinition
  crDataDef = crReportDocument.DataDefinition
                Dim exportFileName As String = "iCalls_CrystalReport_Department.rpt"
                Dim exportPath As String = "D:\SampleCrystalReports\iCalls_Export\test1.pdf"
                Dim crExportOptions As ExportOptions
                Dim crDestOptions As New DiskFileDestinationOptions
                crDestOptions.DiskFileName = exportPath
                crExportOptions = crReportDocument.ExportOptions
                crExportOptions.DestinationOptions = crDestOptions
                crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
                crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
               
  Dim ParamFields As ParameterFields = Me.CrystalReportViewer1.ParameterFieldInfo
                Dim Per As New ParameterField
                Per.ParameterFieldName = "Period"
                Dim ParamCurrentValues As New ParameterValues
                Dim values As New ParameterValues
                Dim Period_Value As New ParameterRangeValue
                Period_Value.StartValue = Me.txtSTdate.Text
                Period_Value.EndValue = Me.txtCLdate.Text
                values.Add(Period_Value)
                crReportDocument.DataDefinition.ParameterFields(0).ApplyCurrentValues(values)
                crReportDocument.Export()
            End If
            For Each cnInfo As TableLogOnInfo In Me.CrystalReportViewer1.LogOnInfo
                cnInfo.ConnectionInfo = ConnInfo
            Next
            Me.CrystalReportViewer1.RefreshReport()
            CrystalReportViewer1.Visible = True           
        Catch ex As Exception
            lblmsg.Text = ex.Message.ToString
        End Try
    End Sub
Thanks.
Thanks,
Yasin.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.