oracle - Query is not filtering data properly -


i have filteration gridview on basis of project_id, date , vehicle_no

but query not filtering properly.

issue is:-

  1. if filter today's date , check, record not show , data, correct.

  2. but if filter exact date , project_id , vehicle_no should show 1 record. still doesn't shows record.

below query filteration.

strquerry = "select distinct sv.mkey, vehicle_no, to_char (date_in, 'dd/mm/yyyy') || ' & ' || time_in vehicleindate_time, to_char (date_out, 'dd/mm/yyyy') || ' & ' " +              "|| time_out vehicleoutdate_time, gate_no_in || ' & ' || gate_no_out ingate_outgateno, gd.good_type goods_type, net_weight netweight, to_char (challan_date, 'dd/mm/yyyy') " +              "|| ' & ' || challan_no challandate_no,remark_in remarkin, null receipt_no, date_in xxcus.xxgid_supinv sv, xxcus.xx_supinv_goodtype gd, " +              "xxcus.xxacl_xxgid_user_mst ms (gd.good_type_code(+) = sv.good_type) , " +              "( sv.project_id = '" + cmbprojectname.selectedvalue + "' , to_char (date_in, 'dd/mm/yyyy') = '" + txtexpcal.value + "' or vehicle_no = '" + ddlvehicleno.selectedvalue + "' ) order date_in desc, vehicle_no"; 

update

the real query after debugging

select distinct sv.mkey, vehicle_no,                to_char (date_in, 'dd/mm/yyyy')             || ' & '             || time_in vehicleindate_time,                to_char (date_out, 'dd/mm/yyyy')             || ' & '             || time_out vehicleoutdate_time,             gate_no_in || ' & ' || gate_no_out ingate_outgateno,             gd.good_type goods_type, net_weight netweight,                to_char (challan_date, 'dd/mm/yyyy')             || ' & '             || challan_no challandate_no,             remark_in remarkin, null receipt_no, date_in        xxcus.xxgid_supinv sv,             xxcus.xx_supinv_goodtype gd,             xxcus.xxacl_xxgid_user_mst ms       (gd.good_type_code(+) = sv.good_type)         , (       sv.project_id = '1368'                 , to_char (date_in, 'dd/mm/yyyy') = '19-09-2015'              or vehicle_no = '29'             )    order date_in desc, vehicle_no 

the problem to_char (date_in, 'dd/mm/yyyy') = '19-09-2015'

you convert date using / delimiter date parameter has - delimiters.

change to_char (date_in, 'dd-mm-yyyy')


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -