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. How to pass parameter with quate to crystal reports from a C# (winform) application

How to pass parameter with quate to crystal reports from a C# (winform) application

Scheduled Pinned Locked Moved C#
csharphelptutorialquestion
7 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.
  • R Offline
    R Offline
    RamiAtia
    wrote on last edited by
    #1

    Hello, How to pass parameter to crystal reports from a C# (winform) application when my parameter is a string type and contain quate or double quate charecter? I keep getting error "Error in formula" when it contains quate or double quate. My parameter name is Address and the address contain double quate sign Thanks in advanced

    S D 2 Replies Last reply
    0
    • R RamiAtia

      Hello, How to pass parameter to crystal reports from a C# (winform) application when my parameter is a string type and contain quate or double quate charecter? I keep getting error "Error in formula" when it contains quate or double quate. My parameter name is Address and the address contain double quate sign Thanks in advanced

      S Offline
      S Offline
      SPanicker
      wrote on last edited by
      #2

      Try providing ASCII values for the double quotes or precede it with escape charachters.

      Regards, SPanicker.

      R 1 Reply Last reply
      0
      • S SPanicker

        Try providing ASCII values for the double quotes or precede it with escape charachters.

        Regards, SPanicker.

        R Offline
        R Offline
        RamiAtia
        wrote on last edited by
        #3

        No, It doesn't work. I keep getting the same error

        S 1 Reply Last reply
        0
        • R RamiAtia

          No, It doesn't work. I keep getting the same error

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

          Can you please provide few lines of the code where u get the error?

          Regards, SPanicker.

          R 1 Reply Last reply
          0
          • R RamiAtia

            Hello, How to pass parameter to crystal reports from a C# (winform) application when my parameter is a string type and contain quate or double quate charecter? I keep getting error "Error in formula" when it contains quate or double quate. My parameter name is Address and the address contain double quate sign Thanks in advanced

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            Use paramterized queries instead of putting SQL strings together using string concatentation.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            1 Reply Last reply
            0
            • S SPanicker

              Can you please provide few lines of the code where u get the error?

              Regards, SPanicker.

              R Offline
              R Offline
              RamiAtia
              wrote on last edited by
              #6

              C# code -------

              int intCopies = 1;
              string strAddress = "6534 Burbank, next to the \"Amy Books\" bookstore";
              string temp = orpt.DataDefinition.FormulaFields["Address1"].Text;
              orpt.DataDefinition.FormulaFields["Address1"].Text = temp.Replace("Address1", strAddress1);
              orpt.Refresh();
              orpt.PrintToPrinter(intCopies, true, 1, 1);

              ------------------------- Crystal Reports --------------- in crystal reports I have a formula named: @Address formula text: "Address" -------------------------- I'm using VS 2005 with Crystal reports version 8.5 Thanks!

              R 1 Reply Last reply
              0
              • R RamiAtia

                C# code -------

                int intCopies = 1;
                string strAddress = "6534 Burbank, next to the \"Amy Books\" bookstore";
                string temp = orpt.DataDefinition.FormulaFields["Address1"].Text;
                orpt.DataDefinition.FormulaFields["Address1"].Text = temp.Replace("Address1", strAddress1);
                orpt.Refresh();
                orpt.PrintToPrinter(intCopies, true, 1, 1);

                ------------------------- Crystal Reports --------------- in crystal reports I have a formula named: @Address formula text: "Address" -------------------------- I'm using VS 2005 with Crystal reports version 8.5 Thanks!

                R Offline
                R Offline
                RamiAtia
                wrote on last edited by
                #7

                Ok, I finally found it. it has to be replaced by a double quate as follow "The word ""hello"" is quoted." so in C# it will be: "The word \"\"hello\"\" is quoted." thanks anyway!

                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