MANEESH AN

MANEESH AN

  • NA
  • 110
  • 46.9k

HOW TO FILTER DATAS USED BY FROMDATE AND TODATE?

Jul 20 2013 2:32 AM
SP

GO
ALTER PROCEDURE [dbo].[sp_PaymentRegisterGridView]
(
  @DTFROM  datetime, 
  @DTTO    datetime
--  @vSeries nvarchar(20)
 
)
AS
BEGIN

SELECT   
ACC.dRPDate DATE,                
ACC.cVType TYPE,        
TS.vSeries SERIES,    
    
ACC.iRPNo VOUCHERNO,         
ACM.vAcName HEAD,        
ACC.vNarration NARRATION,        
ACC.deDRAmount DEBIT,        
ACC.deCRAmount CREDIT        
          
FROM tbl_Acc_Voucher AS ACC INNER JOIN         
tblSerialNumbers AS TS ON ACC.iSeriesId = TS.iSeriesId INNER JOIN         
tbl_Acc_AccountMaster AS ACM ON ACM.iAcID = ACC.iAcID



--where ACC.dRPDate between 01-07-2013 and 05-07-2013
where  convert(DATETIME,ACC.dRPDate,101)>=convert(DATETIME,@DTFROM,101)
AND
convert(DATETIME,ACC.dRPDate,101) <= convert(DATETIME, @DTTO,101)


END

BUTTON VIEW

 f          rmView view = new frmView();
            view.vSeries = txtSeries.Text;
            
            view.Show();
            view.Location = new Point(0, 50);

            DataTable dt = new DataTable();
            dt = objPaymentBL.fnGetPayReg(FROM,TO);


BL

 public DataTable fnGetPayReg(DateTime FROM, DateTime TO)
        {
            DataTable dt = new DataTable();
            dt = objPaymentMasterDL.fnGetPayReg(FROM, TO);
            return dt;
        }

DL

public DataTable fnGetPayReg(DateTime FROM, DateTime TO)
        {


            Connection objCon = new Connection();
            SqlParameter[] parmsDetails = new SqlParameter[1];

            parmsDetails[0] = new SqlParameter();
            parmsDetails[0].SqlDbType = SqlDbType.DateTime;
            parmsDetails[0].Value = FROM;
            parmsDetails[0].ParameterName = "@DTFROM";
            parmsDetails[0] = new SqlParameter();
            parmsDetails[0].SqlDbType = SqlDbType.DateTime;
            parmsDetails[0].Value = TO;
            parmsDetails[0].ParameterName = "@DTTO";
            DataTable dt = new DataTable();
            dt = objCon.fnSelectData("sp_PaymentRegisterGrid", parmsDetails);
            return dt;
        }
IS NEED TO WRITE FORM2 LOAD AFTER CLICK ON BUTTON VIEW IN FORM 1?

Answers (11)