我有一個GridView的這filteration是project_id
,date
和vehicle_no
查詢不過濾數據正確
的基礎上,但我的查詢不正確過濾。
的問題是: -
如果我過濾對於今天的日期,檢查,記錄不顯示和數據,這是完全正確的。
但是,如果過濾器爲
exact date
,project_id
和vehicle_no
它應該顯示一條記錄。但它仍然沒有顯示任何記錄。
以下是我對過濾的查詢。
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 FROM xxcus.xxgid_supinv sv, xxcus.xx_supinv_goodtype gd, " +
"xxcus.xxacl_xxgid_user_mst ms WHERE (gd.good_type_code(+) = sv.good_type) AND " +
"(sv.project_id = '" + cmbProjectName.SelectedValue + "' AND TO_CHAR (date_in, 'dd/MM/yyyy') = '" + txtExpCal.Value + "' OR vehicle_no = '" + ddlVehicleno.SelectedValue + "') ORDER BY date_in DESC, vehicle_no";
UPDATE
真正的查詢調試
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
FROM xxcus.xxgid_supinv sv,
xxcus.xx_supinv_goodtype gd,
xxcus.xxacl_xxgid_user_mst ms
WHERE (gd.good_type_code(+) = sv.good_type)
AND ( sv.project_id = '1368'
AND TO_CHAR (date_in, 'dd/MM/yyyy') = '19-09-2015'
OR vehicle_no = '29'
)
ORDER BY date_in DESC, vehicle_no
是oracle還是mysql?編輯問題並留下正確的標記(看起來像oracle是正確的) – StanislavL
@StanislavL:我的錯誤,是的,它是oracle。任何幫助? – BNN
控件的真實價值是什麼?填補空白後調試併發布真正的查詢字符串。順便說一句,它是SQL注入漏洞。最好使用參數化查詢而不是串接值。 – StanislavL