2016-01-29 89 views
-4

我想從兩個表沒有爲一個或多個必需的參數給定值

  1. 1表是exp_head包含exp_IDexp_name
  2. 第二表是exp_detail包含exp_IDe_datee_amountPaid檢索數據,e_des
  3. 我想檢索sr_no, e_date, e_amountpaid, e_desciption from exp_detail tableexp_name from exp_head並使用內部聯接在ListView中顯示

當前查詢爲:

clsCon.list_DataView(" 
    select exp_detail.sr_no as sr_no, exp_detail.e_date as e_date,exp_head.exp_name as exp_name,exp_detail.e_paid as e_paid,exp_detail.e_des as e_des 
    from exp_detail 
    inner join exp_head on exp_detail.exp_id = exp_head.exp_id 
    where exp_detail.e_date=#" + this.dp_expDetail.Value.Date + "# 
    order by exp_detail.sr_no", this.lstv_ExpDetail); 

(lstv_ExpDetail)是的ListView

的對象,但我得到一個錯誤:

No value given for one or more required parameter

該截圖顯示ListView中,我將展示來自兩個表的數據

enter image description here

+1

能否請您創建一個[最小,完整,可驗證** **示例](http://stackoverflow.com/:

另外,日期值必須爲一個字符串表達式傳遞幫助/ MCVE)?現在很難說出現什麼問題。 –

+1

爲什麼標籤爲C#的問題?代碼片段僅包含SQL。 – Alex

回答

0

No value given for one or more required parameter

這通常表示拼寫錯誤的字段名稱。

where exp_detail.e_date=#" + this.dp_expDetail.Value.Date.ToString("yyyy'/'MM'/'dd") + "# 
+0

當我重新從siingle表中獲取數據並使用這個日期形式時,這將工作正常。但是當我從兩個表重新訪問數據時,這將無法正常工作。 –

+0

錯誤原因是拼寫錯誤... Thanku親愛的 –

相關問題