Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: add multiple values by sql in 1 parameter field Post Reply Post New Topic
Author Message
sarooptrivedi
Newbie
Newbie
Avatar

Joined: 18 Jun 2008
Online Status: Offline
Posts: 10
Quote sarooptrivedi Replybullet Topic: add multiple values by sql in 1 parameter field
    Posted: 25 Jun 2008 at 12:27pm

Hello sir,
thank you for reply
i have another problem regard to paramter fields

        i was design one SQL query. which return the more then one value in integer format.
how can i will pass the all values in one parameter fileds and assign value according to record

and if there are no value for record then 0 value assign for that.

here my code:
============
my method which i was design but it assign last value of sql query to all records in crystal report
----------------------------------------
  public void Sum_spay()
    {
        //// -------feetype
        ////        [1] senior ='S'
        ////        [2] multy ='M'

    ////----------------------------------------------------------------

     ParameterFields pfields = new ParameterFields();
         ParameterField pField = new ParameterField();
         ParameterDiscreteValue disVal = new ParameterDiscreteValue();
         ParameterRangeValue rVal = new ParameterRangeValue();
         sql = "SELECT  COUNT(srno)  FROM License WHERE animaltype = 'D' AND feetype = 'S'   

GROUP BY MONTH(pay_date)";
         cmd = new SqlCommand(sql, con);
         pField.ParameterFieldName = "mul";


         try
         {
             con.Open();
             dr = cmd.ExecuteReader();
             while (dr.Read())
             {
                 disVal.Value = dr[0];
                 pField.CurrentValues.Add(disVal);
                 pfields.Add(pField);
                 dc.SetParameterValue("mul", dr[0]);
                 // Response.Write("<br/>" + dr[0]);
             }
          
             CrystalReportViewer1.ParameterFieldInfo = pfields;
         }
         catch (Exception ex)
         {
             Response.Write(ex.Message);
         }
         finally
         {
             con.Close();
         }

    }


       i hope you understand my problem.
i will wait you reply
thank you
saroop
saroop.trivedi@gmail.com

reply me on my mail id:saroop.trivedi@gmail.com.
crystal report help.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.