Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Changing crystal report connection at runtime

Changing crystal report connection at runtime

Scheduled Pinned Locked Moved C#
helptutoriallearning
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    spy
    wrote on last edited by
    #1

    hey guyz.. anyone know how to change crystal report connection at runtime, im just a beginner of using this.. i can generate reports and filter records, but im worrying about the connection if ever i run this to other computer...i need your help badly...tnx guyz in advance

    S M 2 Replies Last reply
    0
    • S spy

      hey guyz.. anyone know how to change crystal report connection at runtime, im just a beginner of using this.. i can generate reports and filter records, but im worrying about the connection if ever i run this to other computer...i need your help badly...tnx guyz in advance

      S Offline
      S Offline
      sathish s
      wrote on last edited by
      #2

      Try to search for this property setdatabaselogon of the ReportDocument class.

      S 1 Reply Last reply
      0
      • S spy

        hey guyz.. anyone know how to change crystal report connection at runtime, im just a beginner of using this.. i can generate reports and filter records, but im worrying about the connection if ever i run this to other computer...i need your help badly...tnx guyz in advance

        M Offline
        M Offline
        mjmcinto
        wrote on last edited by
        #3

        Try this: Tables tables = reportDocument.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables) { TableLogOnInfo tableLogonInfo = table.LogOnInfo; tableLogonInfo.ConnectionInfo = connectionInfo; table.ApplyLogOnInfo(tableLogonInfo); } reportDocument is your instance of the CrystalDecisions.CrystalReports.EngineReportDocument class, and connectionInfo is the instance of the ConnectionInfo class where you configure the database, username, and password. You can then manage the connection through the web.config (for web) or app.config (for pc based) file, thus allowing you to change it w/out having to recompile. Or you could check certain circumstances, and depending on the outcome, point to different sources.

        S 1 Reply Last reply
        0
        • M mjmcinto

          Try this: Tables tables = reportDocument.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables) { TableLogOnInfo tableLogonInfo = table.LogOnInfo; tableLogonInfo.ConnectionInfo = connectionInfo; table.ApplyLogOnInfo(tableLogonInfo); } reportDocument is your instance of the CrystalDecisions.CrystalReports.EngineReportDocument class, and connectionInfo is the instance of the ConnectionInfo class where you configure the database, username, and password. You can then manage the connection through the web.config (for web) or app.config (for pc based) file, thus allowing you to change it w/out having to recompile. Or you could check certain circumstances, and depending on the outcome, point to different sources.

          S Offline
          S Offline
          spy
          wrote on last edited by
          #4

          tnx guyz..im using web config..n_n

          1 Reply Last reply
          0
          • S sathish s

            Try to search for this property setdatabaselogon of the ReportDocument class.

            S Offline
            S Offline
            spy
            wrote on last edited by
            #5

            tnx for the help..n_n

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups