Results 1 to 8 of 8

Thread: Crystal Report

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    Crystal Report

    I'm using the Crystal Report 9.0 version shipped in VS.NET to create my reports...in the designer I design my report and access my database, where I create my connection with userid/password...The problem is that when I run my report from within my app, a screen pops up for userid/password...anyone know how I can make it go away!
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Search for LogOnInfo and Crystal Reports. You will find your answer.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    searched the forum and net...nothing...am I the only one having this problem?
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    This is not a problem. All you have to do is providing user info in the code. I will send u the code if you couldnt find it out.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  5. #5

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    nothing...you have anything luna?
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  6. #6
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    One quick way will be this:
    Imagine your report is called testcr and your viewer is called CRV:
    VB Code:
    1. Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
    2.         Dim tbl As CrystalDecisions.CrystalReports.Engine.Table
    3.         rpt = New testcr()
    4.             For Each tbl In rpt.Database.Tables
    5.             Dim tbllogin As New CrystalDecisions.Shared.TableLogOnInfo()
    6.             tbllogin.ConnectionInfo.UserID = "admin"
    7.             tbllogin.ConnectionInfo.Password = "eyetalion"
    8.             tbl.ApplyLogOnInfo(tbllogin)
    9.         Next
    10. CRV.ReportSource = rpt
    Note that if you set password for Access database (at database level, not user-level security), the user ID will be "admin".
    You may use it in a more complete way as follows, which is specially useful if you are connecting to a SQL Server.:
    VB Code:
    1. For Each tbl In rpt.Database.Tables
    2.             Dim coninfo As New CrystalDecisions.Shared.ConnectionInfo()
    3.             Dim tbllogin As New CrystalDecisions.Shared.TableLogOnInfo()
    4.             coninfo.Password = "mypassword"
    5.             coninfo.UserID = "myuser"
    6.             coninfo.ServerName = "myserver"
    7.             coninfo.DatabaseName = "mydatabse"
    8.             tbllogin.ConnectionInfo = coninfo
    9.             tbl.ApplyLogOnInfo(tbllogin)
    10. Next

    However its not safe to hard code your password as clear text into your code as it is easily readable from your exe file, so you may try to obfuscate it or use some kind of encryption decryption in your code. Also its too easy to recover Access password, so you may not bother yourself with that and as some say best security is physical security.

    Attached you will find a working example of the above. Note that I have not set the CRV report source at desgin time, unlike the previous example i sent.
    Attached Files Attached Files
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  7. #7

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    thanks again, Luna....that worked..I used logon variables for the userid/password...hate to hardcode, especially passwords!
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  8. #8
    Hyperactive Member stingrae's Avatar
    Join Date
    Apr 2002
    Location
    Sydney
    Posts
    401
    Lunatic3,

    thanks heaps for the download. i now have my app running a report over a PWd db with parameters.

    one last question. what if the locaction of the mdb changes? if i move my mdb from folder X to folder Y then i get this message popup in my code:

    Any ideas?

    Thanks
    Attached Images Attached Images  
    "The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.

    Windows & Web Developer
    Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
    Sutherland Shire, Sydney Australia
    www.stingrae.com.au
    Developer of Arnold - Gym & Martial Arts Database Management System
    www.gymdatabase.com.au

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