Results 1 to 2 of 2

Thread: logon info crystal XI vb.net 2005

  1. #1

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    logon info crystal XI vb.net 2005

    here's my problem i'm trying to connect to a report that i didn't design and sitting on a different machine. i load the report and everything seems like it's going to work. i set all the tables and subreports. the report's connection is initial set to a ODBC. I'm trying to change it to MSSQL which looks like it's going to work but then it pops up asking for a password. i know the username and password are correct since i'm trying to connect to our development server and i'm connected through ent manager to the database's. what am i doing wrong? thanx in advance

    here's my code

    VB Code:
    1. 'Form with viewer
    2. Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
    3.                
    4.                 rpt.Load(list, CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
    5.  
    6.                 'THIS WILL BE REPLACED WITH VALUES FROM CONFIGURATION
    7.                 Dim cnninfo As New CrystalDecisions.Shared.ConnectionInfo
    8.                 cnninfo.DatabaseName = "LTM"
    9.                 cnninfo.ServerName = "DEVSERVER"
    10.                 cnninfo.UserID = "sa"
    11.                 cnninfo.Password = "cssi"
    12.                 cnninfo.Type = CrystalDecisions.Shared.ConnectionInfoType.CRQE
    13.                 Dim cnninfo2 As New CrystalDecisions.Shared.ConnectionInfo
    14.                 cnninfo2.DatabaseName = "TWO"
    15.                 cnninfo2.ServerName = "DEVSERVER"
    16.                 cnninfo2.UserID = "sa"
    17.                 cnninfo2.Password = "cssi"
    18.                 cnninfo.Type = CrystalDecisions.Shared.ConnectionInfoType.CRQE
    19.  
    20.                 GenericCrystalLogin.SetConnectionInfo(rpt, cnninfo, cnninfo2)


    Following is the class where i'm trying to set everything
    VB Code:
    1. Imports CrystalDecisions
    2. Imports CrystalDecisions.CrystalReports
    3. Imports CrystalDecisions.Shared
    4. Imports CrystalDecisions.CrystalReports.Engine
    5.  
    6. Public Class GenericCrystalLogin
    7.  
    8.     Public Shared Sub SetConnectionInfo(ByVal RptDoc As Engine.ReportDocument, _
    9.         ByVal CnnInfo As [Shared].ConnectionInfo, ByVal CnnInfo2 As [Shared].ConnectionInfo)
    10.  
    11.         For Each t As CrystalDecisions.CrystalReports.Engine.Table In RptDoc.Database.Tables
    12.             ApplyLogOnInfoToDatabaseTable(CnnInfo, t)
    13.         Next
    14.  
    15.         For Each sec As CrystalDecisions.CrystalReports.Engine.Section In RptDoc.ReportDefinition.Sections
    16.             For Each RptObj As CrystalDecisions.CrystalReports.Engine.ReportObject In sec.ReportObjects
    17.                 If RptObj.Kind = ReportObjectKind.SubreportObject Then
    18.                     Dim SubRptObj As CrystalReports.Engine.SubreportObject = RptObj
    19.                     Dim SubRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument = SubRptObj.OpenSubreport(SubRptObj.SubreportName)
    20.                     For Each tbl As CrystalDecisions.CrystalReports.Engine.Table In SubRpt.Database.Tables
    21.                         ApplyLogOnInfoToDatabaseTable(CnnInfo, tbl)
    22.                     Next
    23.                 End If
    24.             Next
    25.         Next
    26.     End Sub
    27.  
    28.     Private Shared Sub ApplyLogOnInfoToDatabaseTable(ByVal CnnInfo As [Shared].ConnectionInfo, _
    29.         ByVal aTable As Engine.Table)
    30.         Try
    31.             If Not String.IsNullOrEmpty(CnnInfo.DatabaseName) Then
    32.                 Dim tl As TableLogOnInfo = aTable.LogOnInfo
    33.                 tl.ConnectionInfo = CnnInfo
    34.                 aTable.LogOnInfo.ConnectionInfo.Attributes = CreateLogonProperties(CnnInfo.ServerName, CnnInfo.DatabaseName, CnnInfo.IntegratedSecurity)
    35.                 aTable.ApplyLogOnInfo(tl)
    36.             End If
    37.         Catch ex As Exception
    38.             Throw ex
    39.         End Try
    40.     End Sub
    41.  
    42.     Private Shared Function CreateLogonProperties(ByVal server As String, ByVal db As String, ByVal integ_sec As Boolean) As DbConnectionAttributes
    43.         Dim attrib As New DbConnectionAttributes
    44.         attrib.Collection.Add(New NameValuePair2(DbConnectionAttributes.CONNINFO_DATABASE_DLL, "crdb_ado.dll"))
    45.         attrib.Collection.Add(New NameValuePair2(DbConnectionAttributes.QE_DATABASE_NAME, db))
    46.         attrib.Collection.Add(New NameValuePair2("QE_DatabaseType", "OLE DB (ADO)"))
    47.         attrib.Collection.Add(New NameValuePair2(DbConnectionAttributes.QE_LOGON_PROPERTIES, CreateQELogonProperties(server, db, integ_sec)))
    48.         attrib.Collection.Add(New NameValuePair2(DbConnectionAttributes.QE_SERVER_DESCRIPTION, server))
    49.         attrib.Collection.Add(New NameValuePair2("QE_SQLDB", "True"))
    50.         attrib.Collection.Add(New NameValuePair2(DbConnectionAttributes.CONNINFO_SSO_ENABLED, "False"))
    51.         Return attrib
    52.     End Function
    53.  
    54.     Private Shared Function CreateQELogonProperties(ByVal server As String, ByVal db As String, ByVal integ_sec As Boolean) As DbConnectionAttributes
    55.         Dim attrib As New DbConnectionAttributes
    56.         attrib.Collection.Add(New NameValuePair2("Connection Timeout", "15"))
    57.         attrib.Collection.Add(New NameValuePair2("Data Source", server))
    58.         attrib.Collection.Add(New NameValuePair2("General Timeout", "0"))
    59.         attrib.Collection.Add(New NameValuePair2("Initial Catalog", db))
    60.         attrib.Collection.Add(New NameValuePair2("Integrated Secruity", integ_sec.ToString))
    61.         attrib.Collection.Add(New NameValuePair2("Local Identifier", "2057"))
    62.         attrib.Collection.Add(New NameValuePair2("OLE DB Services", "-5"))
    63.         attrib.Collection.Add(New NameValuePair2("Provider", "SQLOLEDB"))
    64.         attrib.Collection.Add(New NameValuePair2("Tag with column collation when possible", "0"))
    65.         attrib.Collection.Add(New NameValuePair2("Use DSN Default Properties", "False"))
    66.         attrib.Collection.Add(New NameValuePair2("Use Encryption for Data", "0"))
    67.         Return attrib
    68.     End Function
    69. End Class

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  2. #2

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: logon info crystal XI vb.net 2005

    ok i found one mistake i wasn't using the second connection info for the subreport. however it's still won't connected. i have a different report that doesn't have a supreport and it works fine

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width