Results 1 to 2 of 2

Thread: Error:Logon Failed

  1. #1

    Thread Starter
    Addicted Member haihems's Avatar
    Join Date
    Oct 2004
    Posts
    150

    Error:Logon Failed

    Hi,
    I'm Using DAO to connect CR & Excel file.
    From Vb,I have to pass file location, for that I'm using the following code...
    VB Code:
    1. crDoc.Load(RptName)
    2.         crTables = crDoc.Database.Tables
    3.         For Each crTable In crTables
    4.             crTable.Location = BookLocation
    5.         Next
    6.  
    7.         c = crDoc.Subreports.Count
    8.         For i = 0 To c - 1
    9.             SubDoc = crDoc.Subreports.Item(i)
    10.             SubTables = SubDoc.Database.Tables
    11.             For Each SubTable In SubTables
    12.                 SubTable.Location = BookLocation
    13.             Next
    14.         Next
    It is working fine...Now I want to protect the Excel file with password..
    How can i pass the password to the Crystal Report..any idea??
    I tried as follows...but got error...
    VB Code:
    1. Dim myLogin As TableLogOnInfo
    2.  
    3.             For Each crTable In crTables
    4.                 myLogin = crTable.LogOnInfo
    5.  
    6.                 With myLogin.ConnectionInfo
    7.                     .DatabaseName = BookLocation
    8.                     .UserID = "Admin"
    9.                 End With
    10.  
    11.                 crTable.ApplyLogOnInfo(myLogin)
    12.             Next
    BUt it gives error as :
    Logon failed
    Unable to connect: incorrect logon parameters


    And, I read somewhere that, if DAO is used for coneection then the ApplyLogonInfo method will not work..Is it True?...

    I'm struck with this problem...i've to finish this by this week...Help me,quickly
    Think Before Ink

    Visual Studio .NET 2002/.NET Framework 1.0

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: Error:Logon Failed

    VB Code:
    1. crConnectionInfo = New ConnectionInfo
    2.                     With crConnectionInfo
    3.                         .ServerName = "Ares"
    4.                         .DatabaseName = "DBName"
    5.                         .UserID = "UserName"
    6.                         .Password = "YourPass"
    7.                     End With
    8.                     crDatabase = crReportDocument.Database
    9.                     crTables = crDatabase.Tables
    10.                     For Each crTable In crTables
    11.                         crTableLogOnInfo = crTable.LogOnInfo
    12.                         crTableLogOnInfo.ConnectionInfo = crConnectionInfo
    13.                         crTable.ApplyLogOnInfo(crTableLogOnInfo)
    14.                     Next

    Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

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