shah Momin

shah Momin

  • NA
  • 176
  • 21.4k

How To Find Quater Value Year And Month

May 14 2022 1:05 PM
//Quater 2 Record
            int quarterNumber = (dtp_ToDate.Value.Month - 1) / 2 + 3;
            var firstDayOfQuarter = new DateTime(dtp_FromDate.Value.Year, (quarterNumber - 1) / 2 + 3, 1);
            var lastDayOfQuarter = firstDayOfQuarter.AddMonths(3).AddDays(-1);
SqlCommand cmd = new SqlCommand("UIPKGREPORTING_spFetchQuarterlyDayWiseAttendanceReport", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@inVolunteerID", SqlDbType.Int).Value = 0;
            cmd.Parameters.AddWithValue("@inType", drp_Type.Text);
            cmd.Parameters.AddWithValue("@inShift", drp_Shift.Text);
            cmd.Parameters.AddWithValue("@inFromDateTime", firstDayOfQuarter);
            cmd.Parameters.AddWithValue("@inToDateTime", lastDayOfQuarter);
            cmd.Parameters.Add("@inPoints", SqlDbType.Int).Value = -1;
            cmd.Parameters.Add("@inQuarter", SqlDbType.Int).Value = dtp_ToDate.Text;
            MessageBox.Show(firstDayOfQuarter + "-" + lastDayOfQuarter);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataSet dt = new DataSet();
            sda.Fill(dt, "abc");
            dataGridView1.DataSource = dt.Tables["abc"].DefaultView;
            return dt.Tables["abc"];

i Will Featch Worng Data 


Answers (1)