Logon Failed.. Crystal Reports.Net Error (Code Included) 
Author Message
 Logon Failed.. Crystal Reports.Net Error (Code Included)

Hi all,

I'd appreciate any help with the logon failed error. I've checked the
group and crystal's support website. I can't see what I might be
missing.  The report is using an xsd and contains all the fields.  My
dataset is being formed properly..

Thanks in advance.
Tommie

*** CODE ***
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Data.SqlClient
Imports System.Diagnostics
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class WebForm1
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
InitializeComponent()

    End Sub

    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

#Region "Load Crystal Reports & Merge with Datasets/Recordsets"

        Private Function CreateWhereClause(ByVal myArray() As String, ByVal
colName As String) As String
                Dim i As Integer = 0
                'Dim arClientMatterID() As String = Split(Request.Form("1"), ",")
                If myArray.Length() = 1 And CStr(myArray.GetValue(i)) = "" Then
Return ""

                Dim tmpString As String = " WHERE CONTAINS(" & colName & ", ' "
                For i = 0 To myArray.Length - 1
                        tmpString &= Chr(34) & CStr(myArray.GetValue(i)) & "*" & Chr(34)
                        If (i <> myArray.Length - 1) Then tmpString &= " OR "
                Next
                tmpString &= " ')"
                Return tmpString
        End Function

        Private Function GetData(ByVal strReportCriteria As String) As
DataSet
                Dim myDS As New DataSet()
                Dim connStr As String
                Dim sqlSelect As String
                Dim myPath As String =
Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))

                sqlSelect = strReportCriteria
                connStr = ConfigurationSettings.AppSettings("sqlConnectionString")
                Dim mySqlConn As New SqlConnection(connStr)
                Dim mySqlDA As New SqlDataAdapter(sqlSelect, connStr)
                mySqlDA.Fill(myDS, "tblMKT_Report_FLT")
                'myDS.WriteXmlSchema(myPath &
ConfigurationSettings.AppSettings("schema"))
                Return myDS
        End Function

        Private Sub LoadReport(ByRef ds As DataSet)
                Dim myPath As String
                Dim myReport As New ReportDocument()

                myPath = Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))
                myReport.Load(myPath & ConfigurationSettings.AppSettings("rptname"))

                myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogEngineErrors)
                myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogCRPEAPIErrors)

                myReport.Database.Tables(0).SetDataSource(ds)

                Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
                Dim myTableLogonInfos As New
CrystalDecisions.Shared.TableLogOnInfos()
                Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo()
                Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
                Dim myDiskFileDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions()
                Dim myExportFile As String

                myExportFile = myPath & "output\" & Session.SessionID.ToString &
".pdf"

                Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
                Dim count As Integer = 0
                Dim mySERVER As String = ConfigurationSettings.AppSettings("SERVER")
                Dim DBNAME As String = ConfigurationSettings.AppSettings("DBNAME")
                Dim UID As String = ConfigurationSettings.AppSettings("UID")
                Dim PWD As String = ConfigurationSettings.AppSettings("PWD")

                For Each myTable In myReport.Database.Tables
                        myLogin = myTable.LogOnInfo
                        myLogin.ConnectionInfo.ServerName = mySERVER
                        myLogin.ConnectionInfo.DatabaseName = DBNAME
                        myLogin.ConnectionInfo.UserID = UID
                        myLogin.ConnectionInfo.Password = PWD
                        myTable.ApplyLogOnInfo(myLogin)
                Next

                myDiskFileDestinationOptions.DiskFileName = myExportFile
                myExportOptions = myReport.ExportOptions

                With myExportOptions
                        .DestinationOptions = myDiskFileDestinationOptions
                        .ExportDestinationType = .ExportDestinationType.DiskFile
                        .ExportFormatType =
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
                End With

                myReport.Export()

                Response.ClearContent()
                Response.ClearHeaders()
                Response.ContentType = "application/pdf"
                Response.WriteFile(myExportFile)
                Response.Flush()
                Response.Close()
                System.IO.File.Delete(myExportFile)
        End Sub
#End Region

        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
                Session("WhereString") =
CreateWhereClause(Split(Request.Form("lst1"), ","), "ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                'Application("WhereString") =
CreateWhereClause(Split(Request.Form("select1"), ","),
"ClientMatter_ID")
                Session("SqlString") = "Select * from tblMKT_Report_FLT " &
CStr(Session("WhereString"))
                Me.LoadReport(GetData(CStr(Session("SqlString"))))
    End Sub

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

        Dim Message As String
        Message = "Url " & Request.Path & " Error: " &
Server.GetLastError.ToString

        Dim Log As New EventLog()
        Log.Source = "Application"
        Log.Wri{*filter*}try(Message, EventLogEntryType.Error)

    End Sub

End Class



Tue, 09 Aug 2005 00:50:08 GMT  
 Logon Failed.. Crystal Reports.Net Error (Code Included)
There could be two possible problems here:
1)  If you are using DataSets, don't set the logon info, i.e.
Table.ApplyLogonInfo().  We would be reading data from the DataSet, and not
the database.
2)  When using DataSets, use ReportDocument.SetDataSource() instead of
Table.SetDataSource().  Table.SetDataSource() works with DataSets, but may
fail under stress; I have already fixed Table.SetDataSource(), but I don't
know when it will be released.

Thanks,

Francis


Quote:
> Hi all,

> I'd appreciate any help with the logon failed error. I've checked the
> group and crystal's support website. I can't see what I might be
> missing.  The report is using an xsd and contains all the fields.  My
> dataset is being formed properly..

> Thanks in advance.
> Tommie

> *** CODE ***
> Option Explicit On
> Option Strict On
> Imports System.Data
> Imports System.Data.SqlClient
> Imports System.Diagnostics
> Imports CrystalDecisions.CrystalReports.Engine
> Imports CrystalDecisions.Shared

> Public Class WebForm1
>     Inherits System.Web.UI.Page

> #Region " Web Form Designer Generated Code "

>     'This call is required by the Web Form Designer.
>     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> InitializeComponent()

>     End Sub

>     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

> #Region "Load Crystal Reports & Merge with Datasets/Recordsets"

> Private Function CreateWhereClause(ByVal myArray() As String, ByVal
> colName As String) As String
> Dim i As Integer = 0
> 'Dim arClientMatterID() As String = Split(Request.Form("1"), ",")
> If myArray.Length() = 1 And CStr(myArray.GetValue(i)) = "" Then
> Return ""

> Dim tmpString As String = " WHERE CONTAINS(" & colName & ", ' "
> For i = 0 To myArray.Length - 1
> tmpString &= Chr(34) & CStr(myArray.GetValue(i)) & "*" & Chr(34)
> If (i <> myArray.Length - 1) Then tmpString &= " OR "
> Next
> tmpString &= " ')"
> Return tmpString
> End Function

> Private Function GetData(ByVal strReportCriteria As String) As
> DataSet
> Dim myDS As New DataSet()
> Dim connStr As String
> Dim sqlSelect As String
> Dim myPath As String =
> Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))

> sqlSelect = strReportCriteria
> connStr = ConfigurationSettings.AppSettings("sqlConnectionString")
> Dim mySqlConn As New SqlConnection(connStr)
> Dim mySqlDA As New SqlDataAdapter(sqlSelect, connStr)
> mySqlDA.Fill(myDS, "tblMKT_Report_FLT")
> 'myDS.WriteXmlSchema(myPath &
> ConfigurationSettings.AppSettings("schema"))
> Return myDS
> End Function

> Private Sub LoadReport(ByRef ds As DataSet)
> Dim myPath As String
> Dim myReport As New ReportDocument()

> myPath = Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))
> myReport.Load(myPath & ConfigurationSettings.AppSettings("rptname"))

myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogEngineError
s)
myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogCRPEAPIErro
rs)

- Show quoted text -

Quote:

> myReport.Database.Tables(0).SetDataSource(ds)

> Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
> Dim myTableLogonInfos As New
> CrystalDecisions.Shared.TableLogOnInfos()
> Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo()
> Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
> Dim myDiskFileDestinationOptions As New
> CrystalDecisions.Shared.DiskFileDestinationOptions()
> Dim myExportFile As String

> myExportFile = myPath & "output\" & Session.SessionID.ToString &
> ".pdf"

> Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
> Dim count As Integer = 0
> Dim mySERVER As String = ConfigurationSettings.AppSettings("SERVER")
> Dim DBNAME As String = ConfigurationSettings.AppSettings("DBNAME")
> Dim UID As String = ConfigurationSettings.AppSettings("UID")
> Dim PWD As String = ConfigurationSettings.AppSettings("PWD")

> For Each myTable In myReport.Database.Tables
> myLogin = myTable.LogOnInfo
> myLogin.ConnectionInfo.ServerName = mySERVER
> myLogin.ConnectionInfo.DatabaseName = DBNAME
> myLogin.ConnectionInfo.UserID = UID
> myLogin.ConnectionInfo.Password = PWD
> myTable.ApplyLogOnInfo(myLogin)
> Next

> myDiskFileDestinationOptions.DiskFileName = myExportFile
> myExportOptions = myReport.ExportOptions

> With myExportOptions
> .DestinationOptions = myDiskFileDestinationOptions
> .ExportDestinationType = .ExportDestinationType.DiskFile
> .ExportFormatType =
> CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
> End With

> myReport.Export()

> Response.ClearContent()
> Response.ClearHeaders()
> Response.ContentType = "application/pdf"
> Response.WriteFile(myExportFile)
> Response.Flush()
> Response.Close()
> System.IO.File.Delete(myExportFile)
> End Sub
> #End Region

> 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
> Session("WhereString") =
> CreateWhereClause(Split(Request.Form("lst1"), ","), "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> 'Application("WhereString") =
> CreateWhereClause(Split(Request.Form("select1"), ","),
> "ClientMatter_ID")
> Session("SqlString") = "Select * from tblMKT_Report_FLT " &
> CStr(Session("WhereString"))
> Me.LoadReport(GetData(CStr(Session("SqlString"))))
>     End Sub

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

>         Dim Message As String
>         Message = "Url " & Request.Path & " Error: " &
> Server.GetLastError.ToString

>         Dim Log As New EventLog()
>         Log.Source = "Application"
>         Log.Wri{*filter*}try(Message, EventLogEntryType.Error)

>     End Sub

> End Class



Thu, 11 Aug 2005 11:07:15 GMT  
 Logon Failed.. Crystal Reports.Net Error (Code Included)
I have report (8.5) based on SQL Server 2000 stored procedure. Stored
procedure requires 1 varchar parameter. When I run this SP in Query
Analizer, it returns data. If I preview report whithin Crystal environment
all data including parameter field are displayed fine. If I run that report
from VB.NET app it displays parameter field only. No other data at all. I
excluded WHERE clause from my SP. Report displays everything now.
If there is a problem with my WHERE clause in SP then why SP itself works
fine and report in Crystal environment is OK?
Any idea?
vasya


Quote:
> There could be two possible problems here:
> 1)  If you are using DataSets, don't set the logon info, i.e.
> Table.ApplyLogonInfo().  We would be reading data from the DataSet, and
not
> the database.
> 2)  When using DataSets, use ReportDocument.SetDataSource() instead of
> Table.SetDataSource().  Table.SetDataSource() works with DataSets, but may
> fail under stress; I have already fixed Table.SetDataSource(), but I don't
> know when it will be released.

> Thanks,

> Francis



> > Hi all,

> > I'd appreciate any help with the logon failed error. I've checked the
> > group and crystal's support website. I can't see what I might be
> > missing.  The report is using an xsd and contains all the fields.  My
> > dataset is being formed properly..

> > Thanks in advance.
> > Tommie

> > *** CODE ***
> > Option Explicit On
> > Option Strict On
> > Imports System.Data
> > Imports System.Data.SqlClient
> > Imports System.Diagnostics
> > Imports CrystalDecisions.CrystalReports.Engine
> > Imports CrystalDecisions.Shared

> > Public Class WebForm1
> >     Inherits System.Web.UI.Page

> > #Region " Web Form Designer Generated Code "

> >     'This call is required by the Web Form Designer.
> >     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> > InitializeComponent()

> >     End Sub

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

> > #Region "Load Crystal Reports & Merge with Datasets/Recordsets"

> > Private Function CreateWhereClause(ByVal myArray() As String, ByVal
> > colName As String) As String
> > Dim i As Integer = 0
> > 'Dim arClientMatterID() As String = Split(Request.Form("1"), ",")
> > If myArray.Length() = 1 And CStr(myArray.GetValue(i)) = "" Then
> > Return ""

> > Dim tmpString As String = " WHERE CONTAINS(" & colName & ", ' "
> > For i = 0 To myArray.Length - 1
> > tmpString &= Chr(34) & CStr(myArray.GetValue(i)) & "*" & Chr(34)
> > If (i <> myArray.Length - 1) Then tmpString &= " OR "
> > Next
> > tmpString &= " ')"
> > Return tmpString
> > End Function

> > Private Function GetData(ByVal strReportCriteria As String) As
> > DataSet
> > Dim myDS As New DataSet()
> > Dim connStr As String
> > Dim sqlSelect As String
> > Dim myPath As String =
> > Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))

> > sqlSelect = strReportCriteria
> > connStr = ConfigurationSettings.AppSettings("sqlConnectionString")
> > Dim mySqlConn As New SqlConnection(connStr)
> > Dim mySqlDA As New SqlDataAdapter(sqlSelect, connStr)
> > mySqlDA.Fill(myDS, "tblMKT_Report_FLT")
> > 'myDS.WriteXmlSchema(myPath &
> > ConfigurationSettings.AppSettings("schema"))
> > Return myDS
> > End Function

> > Private Sub LoadReport(ByRef ds As DataSet)
> > Dim myPath As String
> > Dim myReport As New ReportDocument()

> > myPath = Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))
> > myReport.Load(myPath & ConfigurationSettings.AppSettings("rptname"))

myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogEngineError
Quote:
> s)

myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogCRPEAPIErro

- Show quoted text -

Quote:
> rs)

> > myReport.Database.Tables(0).SetDataSource(ds)

> > Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
> > Dim myTableLogonInfos As New
> > CrystalDecisions.Shared.TableLogOnInfos()
> > Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo()
> > Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
> > Dim myDiskFileDestinationOptions As New
> > CrystalDecisions.Shared.DiskFileDestinationOptions()
> > Dim myExportFile As String

> > myExportFile = myPath & "output\" & Session.SessionID.ToString &
> > ".pdf"

> > Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
> > Dim count As Integer = 0
> > Dim mySERVER As String = ConfigurationSettings.AppSettings("SERVER")
> > Dim DBNAME As String = ConfigurationSettings.AppSettings("DBNAME")
> > Dim UID As String = ConfigurationSettings.AppSettings("UID")
> > Dim PWD As String = ConfigurationSettings.AppSettings("PWD")

> > For Each myTable In myReport.Database.Tables
> > myLogin = myTable.LogOnInfo
> > myLogin.ConnectionInfo.ServerName = mySERVER
> > myLogin.ConnectionInfo.DatabaseName = DBNAME
> > myLogin.ConnectionInfo.UserID = UID
> > myLogin.ConnectionInfo.Password = PWD
> > myTable.ApplyLogOnInfo(myLogin)
> > Next

> > myDiskFileDestinationOptions.DiskFileName = myExportFile
> > myExportOptions = myReport.ExportOptions

> > With myExportOptions
> > .DestinationOptions = myDiskFileDestinationOptions
> > .ExportDestinationType = .ExportDestinationType.DiskFile
> > .ExportFormatType =
> > CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
> > End With

> > myReport.Export()

> > Response.ClearContent()
> > Response.ClearHeaders()
> > Response.ContentType = "application/pdf"
> > Response.WriteFile(myExportFile)
> > Response.Flush()
> > Response.Close()
> > System.IO.File.Delete(myExportFile)
> > End Sub
> > #End Region

> > 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
> > Session("WhereString") =
> > CreateWhereClause(Split(Request.Form("lst1"), ","), "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > Session("SqlString") = "Select * from tblMKT_Report_FLT " &
> > CStr(Session("WhereString"))
> > Me.LoadReport(GetData(CStr(Session("SqlString"))))
> >     End Sub

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

> >         Dim Message As String
> >         Message = "Url " & Request.Path & " Error: " &
> > Server.GetLastError.ToString

> >         Dim Log As New EventLog()
> >         Log.Source = "Application"
> >         Log.Wri{*filter*}try(Message, EventLogEntryType.Error)

> >     End Sub

> > End Class



Sun, 14 Aug 2005 03:06:11 GMT  
 Logon Failed.. Crystal Reports.Net Error (Code Included)
Sorry for misplacing my own question here
vasya


Quote:
> There could be two possible problems here:
> 1)  If you are using DataSets, don't set the logon info, i.e.
> Table.ApplyLogonInfo().  We would be reading data from the DataSet, and
not
> the database.
> 2)  When using DataSets, use ReportDocument.SetDataSource() instead of
> Table.SetDataSource().  Table.SetDataSource() works with DataSets, but may
> fail under stress; I have already fixed Table.SetDataSource(), but I don't
> know when it will be released.

> Thanks,

> Francis



> > Hi all,

> > I'd appreciate any help with the logon failed error. I've checked the
> > group and crystal's support website. I can't see what I might be
> > missing.  The report is using an xsd and contains all the fields.  My
> > dataset is being formed properly..

> > Thanks in advance.
> > Tommie

> > *** CODE ***
> > Option Explicit On
> > Option Strict On
> > Imports System.Data
> > Imports System.Data.SqlClient
> > Imports System.Diagnostics
> > Imports CrystalDecisions.CrystalReports.Engine
> > Imports CrystalDecisions.Shared

> > Public Class WebForm1
> >     Inherits System.Web.UI.Page

> > #Region " Web Form Designer Generated Code "

> >     'This call is required by the Web Form Designer.
> >     <System.Diagnostics.De{*filter*}StepThrough()> Private Sub
> > InitializeComponent()

> >     End Sub

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

> > #Region "Load Crystal Reports & Merge with Datasets/Recordsets"

> > Private Function CreateWhereClause(ByVal myArray() As String, ByVal
> > colName As String) As String
> > Dim i As Integer = 0
> > 'Dim arClientMatterID() As String = Split(Request.Form("1"), ",")
> > If myArray.Length() = 1 And CStr(myArray.GetValue(i)) = "" Then
> > Return ""

> > Dim tmpString As String = " WHERE CONTAINS(" & colName & ", ' "
> > For i = 0 To myArray.Length - 1
> > tmpString &= Chr(34) & CStr(myArray.GetValue(i)) & "*" & Chr(34)
> > If (i <> myArray.Length - 1) Then tmpString &= " OR "
> > Next
> > tmpString &= " ')"
> > Return tmpString
> > End Function

> > Private Function GetData(ByVal strReportCriteria As String) As
> > DataSet
> > Dim myDS As New DataSet()
> > Dim connStr As String
> > Dim sqlSelect As String
> > Dim myPath As String =
> > Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))

> > sqlSelect = strReportCriteria
> > connStr = ConfigurationSettings.AppSettings("sqlConnectionString")
> > Dim mySqlConn As New SqlConnection(connStr)
> > Dim mySqlDA As New SqlDataAdapter(sqlSelect, connStr)
> > mySqlDA.Fill(myDS, "tblMKT_Report_FLT")
> > 'myDS.WriteXmlSchema(myPath &
> > ConfigurationSettings.AppSettings("schema"))
> > Return myDS
> > End Function

> > Private Sub LoadReport(ByRef ds As DataSet)
> > Dim myPath As String
> > Dim myReport As New ReportDocument()

> > myPath = Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))
> > myReport.Load(myPath & ConfigurationSettings.AppSettings("rptname"))

myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogEngineError
Quote:
> s)

myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogCRPEAPIErro

- Show quoted text -

Quote:
> rs)

> > myReport.Database.Tables(0).SetDataSource(ds)

> > Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
> > Dim myTableLogonInfos As New
> > CrystalDecisions.Shared.TableLogOnInfos()
> > Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo()
> > Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
> > Dim myDiskFileDestinationOptions As New
> > CrystalDecisions.Shared.DiskFileDestinationOptions()
> > Dim myExportFile As String

> > myExportFile = myPath & "output\" & Session.SessionID.ToString &
> > ".pdf"

> > Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
> > Dim count As Integer = 0
> > Dim mySERVER As String = ConfigurationSettings.AppSettings("SERVER")
> > Dim DBNAME As String = ConfigurationSettings.AppSettings("DBNAME")
> > Dim UID As String = ConfigurationSettings.AppSettings("UID")
> > Dim PWD As String = ConfigurationSettings.AppSettings("PWD")

> > For Each myTable In myReport.Database.Tables
> > myLogin = myTable.LogOnInfo
> > myLogin.ConnectionInfo.ServerName = mySERVER
> > myLogin.ConnectionInfo.DatabaseName = DBNAME
> > myLogin.ConnectionInfo.UserID = UID
> > myLogin.ConnectionInfo.Password = PWD
> > myTable.ApplyLogOnInfo(myLogin)
> > Next

> > myDiskFileDestinationOptions.DiskFileName = myExportFile
> > myExportOptions = myReport.ExportOptions

> > With myExportOptions
> > .DestinationOptions = myDiskFileDestinationOptions
> > .ExportDestinationType = .ExportDestinationType.DiskFile
> > .ExportFormatType =
> > CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
> > End With

> > myReport.Export()

> > Response.ClearContent()
> > Response.ClearHeaders()
> > Response.ContentType = "application/pdf"
> > Response.WriteFile(myExportFile)
> > Response.Flush()
> > Response.Close()
> > System.IO.File.Delete(myExportFile)
> > End Sub
> > #End Region

> > 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
> > Session("WhereString") =
> > CreateWhereClause(Split(Request.Form("lst1"), ","), "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > 'Application("WhereString") =
> > CreateWhereClause(Split(Request.Form("select1"), ","),
> > "ClientMatter_ID")
> > Session("SqlString") = "Select * from tblMKT_Report_FLT " &
> > CStr(Session("WhereString"))
> > Me.LoadReport(GetData(CStr(Session("SqlString"))))
> >     End Sub

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

> >         Dim Message As String
> >         Message = "Url " & Request.Path & " Error: " &
> > Server.GetLastError.ToString

> >         Dim Log As New EventLog()
> >         Log.Source = "Application"
> >         Log.Wri{*filter*}try(Message, EventLogEntryType.Error)

> >     End Sub

> > End Class



Mon, 15 Aug 2005 06:38:49 GMT  
 Logon Failed.. Crystal Reports.Net Error (Code Included)
Francis -

Thanks for your reply. I was able to login successfully (to the main
report) by changing the SetDataSource (ds) to SetDataSource
(ds.Tables.("TableName"))

I am having a similiar error when I try to add a sub report to my .Net
Web application. So far, I've tried updating the crystal .dll's from
their weekly hot fix update site.

No luck there so I'm posting my latest code which handles logging into
the report and the subreport.  Perhaps SOMEONE might be able to spot
what I am missing..

Note: I'm seeing an Event ID: 713 in the web server machine when I try
to run this report code. I also get  the Logon Failed error in the
browser.

*** CODE BEGINS **
    Private Sub LoadReport(ByRef ds As DataSet)
        Dim myPath As String
        Dim myReport As New ReportDocument()
        Dim TBNAME As String =
ConfigurationSettings.AppSettings("TABLENAME")

        myPath = Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))
        myReport.Load(myPath &
ConfigurationSettings.AppSettings("rptname"))

        myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogEngineErrors)
        myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogCRPEAPIErrors)

        myReport.SetDataSource(ds.Tables(TBNAME))

        Dim mySection As Section
        Dim mySections As Sections
        Dim myReportObject As ReportObject
        Dim myReportObjects As ReportObjects
        Dim mySubReportObject As SubreportObject
        Dim mySubRepDoc As New ReportDocument()
        Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
        'Dim myTableLogonInfos As New
CrystalDecisions.Shared.TableLogOnInfos()
        Dim myConnectionInfo As New
CrystalDecisions.Shared.ConnectionInfo()
        Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
        Dim myDiskFileDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions()
        Dim myExportFile As String

        myExportFile = myPath & "output\" & Session.SessionID.ToString
& ".pdf"

        Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
        Dim count As Integer = 0
        Dim mySERVER As String =
ConfigurationSettings.AppSettings("SERVER")
        Dim DBNAME As String =
ConfigurationSettings.AppSettings("DBNAME")
        Dim UID As String = ConfigurationSettings.AppSettings("UID")
        Dim PWD As String = ConfigurationSettings.AppSettings("PWD")

        'Sets the login information for the main report
        For Each myTable In myReport.Database.Tables
            myLogin = myTable.LogOnInfo
            myLogin.ConnectionInfo.ServerName = mySERVER
            myLogin.ConnectionInfo.DatabaseName = DBNAME
            myLogin.ConnectionInfo.UserID = UID
            myLogin.ConnectionInfo.Password = PWD
            myTable.ApplyLogOnInfo(myLogin)
        Next

        'Declare all of the sections of the main report
        mySections = myReport.ReportDefinition.Sections

        'Loop through the sections in the main report to find the
subreport objects
        'then set the logon information to the subreport
        For Each mySection In mySections
            myReportObjects = mySection.ReportObjects
            For Each myReportObject In myReportObjects
                If myReportObject.Kind =
ReportObjectKind.SubreportObject Then
                    'Subreport Found - convert the report object to a
sub report type
                    mySubReportObject = CType(myReportObject,
SubreportObject)
                    'Set the specific instance of this subreport
                    mySubRepDoc =
mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
                    'Set the login information for the current
subreport found
                    For Each myTable In mySubRepDoc.Database.Tables
                        myLogin = myTable.LogOnInfo
                        myLogin.ConnectionInfo.ServerName = mySERVER
                        myLogin.ConnectionInfo.DatabaseName = DBNAME
                        myLogin.ConnectionInfo.UserID = UID
                        myLogin.ConnectionInfo.Password = PWD
                        myTable.ApplyLogOnInfo(myLogin)
                    Next
                End If
            Next
        Next

        myDiskFileDestinationOptions.DiskFileName = myExportFile
        myExportOptions = myReport.ExportOptions

        With myExportOptions
            .DestinationOptions = myDiskFileDestinationOptions
            .ExportDestinationType = .ExportDestinationType.DiskFile
            .ExportFormatType =
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
        End With

        myReport.Export()

        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf"
        Response.WriteFile(myExportFile)
        Response.Flush()
        Response.Close()
        System.IO.File.Delete(myExportFile)
        ds.Clear()

    End Sub
** END CODE SNIP.. ***
..."snipped"

Quote:



> > There could be two possible problems here:
> > 1)  If you are using DataSets, don't set the logon info, i.e.
> > Table.ApplyLogonInfo().  We would be reading data from the DataSet, and
>  not
> > the database.
> > 2)  When using DataSets, use ReportDocument.SetDataSource() instead of
> > Table.SetDataSource().  Table.SetDataSource() works with DataSets, but may
> > fail under stress; I have already fixed Table.SetDataSource(), but I don't
> > know when it will be released.

> > Thanks,

> > Francis



> > > Hi all,

> > > I'd appreciate any help with the logon failed error. I've checked the
> > > group and crystal's support website. I can't see what I might be
> > > missing.  The report is using an xsd and contains all the fields.  My
> > > dataset is being formed properly..

> > > Thanks in advance.
> > > Tommie

.. "snipped"


Wed, 24 Aug 2005 06:36:40 GMT  
 Logon Failed.. Crystal Reports.Net Error (Code Included)
Thanks all,

I found the answer and posted this fix in a separate thread.
Essentially, I found that you have to open the subreport as indicated
below but the next line should set the datasource for the subreport.
All the login routines are unnecessary in Crystal.Net.

Tom

Quote:

> Francis -

> Thanks for your reply. I was able to login successfully (to the main
> report) by changing the SetDataSource (ds) to SetDataSource
> (ds.Tables.("TableName"))

> I am having a similiar error when I try to add a sub report to my .Net
> Web application. So far, I've tried updating the crystal .dll's from
> their weekly hot fix update site.

> No luck there so I'm posting my latest code which handles logging into
> the report and the subreport.  Perhaps SOMEONE might be able to spot
> what I am missing..

> Note: I'm seeing an Event ID: 713 in the web server machine when I try
> to run this report code. I also get  the Logon Failed error in the
> browser.

> *** CODE BEGINS **
>     Private Sub LoadReport(ByRef ds As DataSet)
>         Dim myPath As String
>         Dim myReport As New ReportDocument()
>         Dim TBNAME As String =
> ConfigurationSettings.AppSettings("TABLENAME")

>         myPath = Server.MapPath(ConfigurationSettings.AppSettings("AppPath"))
>         myReport.Load(myPath &
> ConfigurationSettings.AppSettings("rptname"))

>         myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogEngineErrors)
>         myReport.EnableEventLog(CrystalDecisions.Shared.EventLogLevel.LogCRPEAPIErrors)

>         myReport.SetDataSource(ds.Tables(TBNAME))

>         Dim mySection As Section
>         Dim mySections As Sections
>         Dim myReportObject As ReportObject
>         Dim myReportObjects As ReportObjects
>         Dim mySubReportObject As SubreportObject
>         Dim mySubRepDoc As New ReportDocument()
>         Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
>         'Dim myTableLogonInfos As New
> CrystalDecisions.Shared.TableLogOnInfos()
>         Dim myConnectionInfo As New
> CrystalDecisions.Shared.ConnectionInfo()
>         Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
>         Dim myDiskFileDestinationOptions As New
> CrystalDecisions.Shared.DiskFileDestinationOptions()
>         Dim myExportFile As String

>         myExportFile = myPath & "output\" & Session.SessionID.ToString
> & ".pdf"

>         Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
>         Dim count As Integer = 0
>         Dim mySERVER As String =
> ConfigurationSettings.AppSettings("SERVER")
>         Dim DBNAME As String =
> ConfigurationSettings.AppSettings("DBNAME")
>         Dim UID As String = ConfigurationSettings.AppSettings("UID")
>         Dim PWD As String = ConfigurationSettings.AppSettings("PWD")

>         'Sets the login information for the main report
>         For Each myTable In myReport.Database.Tables
>             myLogin = myTable.LogOnInfo
>             myLogin.ConnectionInfo.ServerName = mySERVER
>             myLogin.ConnectionInfo.DatabaseName = DBNAME
>             myLogin.ConnectionInfo.UserID = UID
>             myLogin.ConnectionInfo.Password = PWD
>             myTable.ApplyLogOnInfo(myLogin)
>         Next

>         'Declare all of the sections of the main report
>         mySections = myReport.ReportDefinition.Sections

>         'Loop through the sections in the main report to find the
> subreport objects
>         'then set the logon information to the subreport
>         For Each mySection In mySections
>             myReportObjects = mySection.ReportObjects
>             For Each myReportObject In myReportObjects
>                 If myReportObject.Kind =
> ReportObjectKind.SubreportObject Then
>                     'Subreport Found - convert the report object to a
> sub report type
>                     mySubReportObject = CType(myReportObject,
> SubreportObject)
>                     'Set the specific instance of this subreport
>                     mySubRepDoc =
> mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
>                     'Set the login information for the current
> subreport found
>                     For Each myTable In mySubRepDoc.Database.Tables
>                         myLogin = myTable.LogOnInfo
>                         myLogin.ConnectionInfo.ServerName = mySERVER
>                         myLogin.ConnectionInfo.DatabaseName = DBNAME
>                         myLogin.ConnectionInfo.UserID = UID
>                         myLogin.ConnectionInfo.Password = PWD
>                         myTable.ApplyLogOnInfo(myLogin)
>                     Next
>                 End If
>             Next
>         Next

>         myDiskFileDestinationOptions.DiskFileName = myExportFile
>         myExportOptions = myReport.ExportOptions

>         With myExportOptions
>             .DestinationOptions = myDiskFileDestinationOptions
>             .ExportDestinationType = .ExportDestinationType.DiskFile
>             .ExportFormatType =
> CrystalDecisions.Shared.ExportFormatType.PortableDocFormat
>         End With

>         myReport.Export()

>         Response.ClearContent()
>         Response.ClearHeaders()
>         Response.ContentType = "application/pdf"
>         Response.WriteFile(myExportFile)
>         Response.Flush()
>         Response.Close()
>         System.IO.File.Delete(myExportFile)
>         ds.Clear()

>     End Sub
> ** END CODE SNIP.. ***
> ..."snipped"



> > > There could be two possible problems here:
> > > 1)  If you are using DataSets, don't set the logon info, i.e.
> > > Table.ApplyLogonInfo().  We would be reading data from the DataSet, and
>  not
> > > the database.
> > > 2)  When using DataSets, use ReportDocument.SetDataSource() instead of
> > > Table.SetDataSource().  Table.SetDataSource() works with DataSets, but may
> > > fail under stress; I have already fixed Table.SetDataSource(), but I don't
> > > know when it will be released.

> > > Thanks,

> > > Francis



> > > > Hi all,

> > > > I'd appreciate any help with the logon failed error. I've checked the
> > > > group and crystal's support website. I can't see what I might be
> > > > missing.  The report is using an xsd and contains all the fields.  My
> > > > dataset is being formed properly..

> > > > Thanks in advance.
> > > > Tommie
> .. "snipped"



Sat, 27 Aug 2005 02:05:17 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Crystal Report in .NET - Logon Failed Error while Exporting

2. FYI - Logon Failed in Crystal.Net having Subreports (Working Code Supplied)

3. Logon failed. Crystal Reports .NET

4. Crystal and .NET: Logon failed

5. .Net Crystal Viewer Logon Failed

6. dot net logon failed in sub reports

7. Desperately Need HELP!!!!-Crystal Report-Logon Fail - Can anyone even give me a lead

8. Help-"Error5-Logon Failed"-HELP PLease!!!!!!-Crystal Report

9. Logon Failed when exportign crystal report to PDF (or any other format)

10. Logon Failed For Crystal Reports

11. CR9 -> Access: Logon failed Error Code 0x80040154

12. Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion

 

 
Powered by phpBB® Forum Software