i fix it
and i just want that if i didnt give date parameter and i use voucher no parameter then result gives me result from voucher number
ALTER procedure [dbo].[vocuher]
@VoucherNo int,
@VoucherType varchar(50),
@FromDate DATETIME,
@ToDate DATETIME
as
begin
select
vm.VoucherTypeCode,
vt.VoucherType,
vd.VoucherNo,
vm.VoucherDate,
vm.Narration
from VoucherMaster vm
left join VoucherDetail vd on vm.VoucherTypeCode = vd.VoucherTypeCode
left join VoucherType vt on vd.VoucherTypeCode = vt.VoucherTypeCode
where
(ISNULL(@VoucherNo,'')='' OR vd.voucherno = @VoucherNo)
and vm.VoucherDate BETWEEN @FromDate and @ToDate
--and vd.voucherno = @VoucherNo
end
thanks for the help
immad