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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. passing parameter to crystal report

passing parameter to crystal report

Scheduled Pinned Locked Moved ASP.NET
sysadminhelptutorialquestionworkspace
5 Posts 2 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.
  • B Offline
    B Offline
    bazpaul
    wrote on last edited by
    #1

    Hello all, I have been working on this project for quite some time now and to be honest i cant stand it anymore! I have a simple request, i want to get a parameter, taken from a querysting and pass it to a crystal report. I have setup the crystal report viewer on my default.aspx page and by setting the default value of the parameter, i am able to view the crystal report. Here is the follwing code that i use --------------------------------------------------------------------------------- ------------------------------------------------------------------------------------ This code works fine, however i want to have the parameter SERVER_ID to be taken from a querystring sent to this page! Si in my innocence i thought, instead of having the defaultvalue="45" can i use DefaultValue=" <% response.write request.querystring('server_id') %>" but this doesnt work. I have read somewhere that like a control parameter one can code a querystring parameter! Does anyone know how to do this?? Im sure someone can help me, the idea behinf this is so simple, but im only new to Asp and am not sure where im goin wrong. If anyone can help it would be greatly appreciated!

    D 1 Reply Last reply
    0
    • B bazpaul

      Hello all, I have been working on this project for quite some time now and to be honest i cant stand it anymore! I have a simple request, i want to get a parameter, taken from a querysting and pass it to a crystal report. I have setup the crystal report viewer on my default.aspx page and by setting the default value of the parameter, i am able to view the crystal report. Here is the follwing code that i use --------------------------------------------------------------------------------- ------------------------------------------------------------------------------------ This code works fine, however i want to have the parameter SERVER_ID to be taken from a querystring sent to this page! Si in my innocence i thought, instead of having the defaultvalue="45" can i use DefaultValue=" <% response.write request.querystring('server_id') %>" but this doesnt work. I have read somewhere that like a control parameter one can code a querystring parameter! Does anyone know how to do this?? Im sure someone can help me, the idea behinf this is so simple, but im only new to Asp and am not sure where im goin wrong. If anyone can help it would be greatly appreciated!

      D Offline
      D Offline
      DISP Jol
      wrote on last edited by
      #2

      Do you get any runtime exception ?? Make sure the parameter type on the report and your program match... Also try using DefaultValue=" <% request.querystring('server_id').tostring() %>" Let me know...

      JO

      B 1 Reply Last reply
      0
      • D DISP Jol

        Do you get any runtime exception ?? Make sure the parameter type on the report and your program match... Also try using DefaultValue=" <% request.querystring('server_id').tostring() %>" Let me know...

        JO

        B Offline
        B Offline
        bazpaul
        wrote on last edited by
        #3

        Jo, thanks for your reply and suggestions 1. no i dont get any runtime exception 2. yes the parameters match 3. i tried ur method but it acts the same as mine, it simply prompts for the parameter, server_id i was reading on MSDN site that one can use a querystringparameter; http://msdn2.microsoft.com/en-us/library/ms227827(VS.80).aspx[^] However i cannot find any example that use this and cannot get the querystringparameter tag to work! Could it be that the crystalreportsource control does not allow this segment of asp code?? Could it be somethin wrong with my web.config file or something im not including in the default.aspx.vb page???? Any help would be great, Thanks again

        D 1 Reply Last reply
        0
        • B bazpaul

          Jo, thanks for your reply and suggestions 1. no i dont get any runtime exception 2. yes the parameters match 3. i tried ur method but it acts the same as mine, it simply prompts for the parameter, server_id i was reading on MSDN site that one can use a querystringparameter; http://msdn2.microsoft.com/en-us/library/ms227827(VS.80).aspx[^] However i cannot find any example that use this and cannot get the querystringparameter tag to work! Could it be that the crystalreportsource control does not allow this segment of asp code?? Could it be somethin wrong with my web.config file or something im not including in the default.aspx.vb page???? Any help would be great, Thanks again

          D Offline
          D Offline
          DISP Jol
          wrote on last edited by
          #4

          Is this report being set off by a click of a button... Just a thought...Try saving this query string variable in viewstate in your page_load method... ViewState("x")=QueryString("serverid").tostring() Then use ViewState as a parameter... If you have prepared crystal document object use crDcoument.Parameters.Add(x,y) method to associate the parameter value with the report.. x=name of the parameter in crystal report y=value of the parameter..in ur case its ViewState("x").tostring() Let me know

          JO

          B 1 Reply Last reply
          0
          • D DISP Jol

            Is this report being set off by a click of a button... Just a thought...Try saving this query string variable in viewstate in your page_load method... ViewState("x")=QueryString("serverid").tostring() Then use ViewState as a parameter... If you have prepared crystal document object use crDcoument.Parameters.Add(x,y) method to associate the parameter value with the report.. x=name of the parameter in crystal report y=value of the parameter..in ur case its ViewState("x").tostring() Let me know

            JO

            B Offline
            B Offline
            bazpaul
            wrote on last edited by
            #5

            JO No, i click a hyperlink in a page which directs to default.aspx like this /default.aspx?Server_id=45 then in default.aspx i have a request.querystring('server_id') statement, this all works, and i can read the value 45, but i cant insert the request statement into the crystalreportsource control! Im not great with VB, and so dont really understand what you mean by ur last post Jo, but am i wrong in my method, surely it should be so simple! Could it be something got to do with the crystalreportsource control. like it doesnt accept asp code in the middle of it?? I am also reviewing this example, and i cant pass a parameter into that either!!! http://www.codeproject.com/vb/net/CrystalReports_in_VBNET.asp[^] Aaaaahhhh, please someone help :sigh:

            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