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. Dynamic parameter to crystal report using SQL Command

Dynamic parameter to crystal report using SQL Command

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadminhelpquestion
3 Posts 3 Posters 1 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Please help; For a couple days I've been battling with writing a report that has to tables linked by a Inner join. I think I found a work around. I'm using an SQL SERVER database. Crystal was creating the following query: SELECT t_EMPINFO.c_EmpFName, t_EMPINFO.c_EmpCode, t_Employee_Salary.c_TotalIncome, t_Employee_Salary.c_TotalDeduction, t_Employee_Salary.c_TotalSalary FROM t_EMPINFO INNER JOIN t_Employee_Salary ON t_EMPINFO.c_EmpID = t_Employee_Salary.c_EmpId WHERE (t_EMPINFO.c_Softdelete = '1') AND (t_Employee_Salary.c_SoftDelete = '1') AND (t_Employee_Salary.c_Year = 'PARAMETER1') AND (t_Employee_Salary.c_Month ='PARAMETER2') IN Above Query In place of :rose: PARAMETER1 and :rose: PARAMETER2 I want to pass Differnt value at the run time (e.g 2007 , 01 ) how it's set dynamically I have questions though: 1) Is it possible to change the sql that crystal generates without writing my own sql command? Thanks again for all of your help on this!

    R A 2 Replies Last reply
    0
    • L Lost User

      Please help; For a couple days I've been battling with writing a report that has to tables linked by a Inner join. I think I found a work around. I'm using an SQL SERVER database. Crystal was creating the following query: SELECT t_EMPINFO.c_EmpFName, t_EMPINFO.c_EmpCode, t_Employee_Salary.c_TotalIncome, t_Employee_Salary.c_TotalDeduction, t_Employee_Salary.c_TotalSalary FROM t_EMPINFO INNER JOIN t_Employee_Salary ON t_EMPINFO.c_EmpID = t_Employee_Salary.c_EmpId WHERE (t_EMPINFO.c_Softdelete = '1') AND (t_Employee_Salary.c_SoftDelete = '1') AND (t_Employee_Salary.c_Year = 'PARAMETER1') AND (t_Employee_Salary.c_Month ='PARAMETER2') IN Above Query In place of :rose: PARAMETER1 and :rose: PARAMETER2 I want to pass Differnt value at the run time (e.g 2007 , 01 ) how it's set dynamically I have questions though: 1) Is it possible to change the sql that crystal generates without writing my own sql command? Thanks again for all of your help on this!

      R Offline
      R Offline
      Reza Raad
      wrote on last edited by
      #2

      you can use PARAMETER FIELD in crystal report for handling this. more about parameter fields here: http://support.businessobjects.com/documentation/product_guides/cr_net/vs_2005/html/crtsktutorialsrdparametersdiscretecreatingreport.htm[^]

      Human knowlege belongs to the world

      1 Reply Last reply
      0
      • L Lost User

        Please help; For a couple days I've been battling with writing a report that has to tables linked by a Inner join. I think I found a work around. I'm using an SQL SERVER database. Crystal was creating the following query: SELECT t_EMPINFO.c_EmpFName, t_EMPINFO.c_EmpCode, t_Employee_Salary.c_TotalIncome, t_Employee_Salary.c_TotalDeduction, t_Employee_Salary.c_TotalSalary FROM t_EMPINFO INNER JOIN t_Employee_Salary ON t_EMPINFO.c_EmpID = t_Employee_Salary.c_EmpId WHERE (t_EMPINFO.c_Softdelete = '1') AND (t_Employee_Salary.c_SoftDelete = '1') AND (t_Employee_Salary.c_Year = 'PARAMETER1') AND (t_Employee_Salary.c_Month ='PARAMETER2') IN Above Query In place of :rose: PARAMETER1 and :rose: PARAMETER2 I want to pass Differnt value at the run time (e.g 2007 , 01 ) how it's set dynamically I have questions though: 1) Is it possible to change the sql that crystal generates without writing my own sql command? Thanks again for all of your help on this!

        A Offline
        A Offline
        alav
        wrote on last edited by
        #3

        Hi, If you are using VS2005. I think the following will helps to you. 1) Make the EnableParameterPrompt to false. 2) For your example create two text box and a button. 3) In the button click event add the following code. CrystalReportSource1.ReportDocument.SetParameterValue(0,TextBox1.Text) CrystalReportSource1.ReportDocument.SetParameterValue(1,TextBox2.Text) Thats it.

        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