朋友們有遇到過這樣的問題嗎? DataAdapter 填充Datatable 回傳的資料為空,除錯的sql陳述句在plsql里是可以查到資料的,在我的電腦上是這樣,在同事的電腦上是正常的,好苦惱啊
,求借鑒
uj5u.com熱心網友回復:
沒代碼你說個鳥uj5u.com熱心網友回復:
Public Function Get_ApplyList_RGCB(ByVal iyear As String, ByVal cdepcodes As String, ByVal cfeetypecode As String) As DataTableDim strsql As New StringBuilder
strsql.Append(" select ")
strsql.Append(" ta.cfeeitemcodefirst,ta.cfeeitemnamefirst,ta.cfeeitemcodesecond,ta.cfeeitemnamesecond,ta.cfeeitemcodethird,ta.cfeeitemnamethird, ")
strsql.Append(" sum(case when ta.imonth=1 then ta.itotalapply else 0 end) as January, ")
strsql.Append(" sum(case when ta.imonth=2 then ta.itotalapply else 0 end) as February, ")
strsql.Append(" sum(case when ta.imonth=3 then ta.itotalapply else 0 end) as March, ")
strsql.Append(" sum(case when ta.imonth=4 then ta.itotalapply else 0 end) as April, ")
strsql.Append(" sum(case when ta.imonth=5 then ta.itotalapply else 0 end) as May, ")
strsql.Append(" sum(case when ta.imonth=6 then ta.itotalapply else 0 end) as June, ")
strsql.Append(" sum(case when ta.imonth=7 then ta.itotalapply else 0 end) as July, ")
strsql.Append(" sum(case when ta.imonth=8 then ta.itotalapply else 0 end) as August, ")
strsql.Append(" sum(case when ta.imonth=9 then ta.itotalapply else 0 end) as September, ")
strsql.Append(" sum(case when ta.imonth=10 then ta.itotalapply else 0 end) as October, ")
strsql.Append(" sum(case when ta.imonth=11 then ta.itotalapply else 0 end) as November, ")
strsql.Append(" sum(case when ta.imonth=12 then ta.itotalapply else 0 end) as December, ")
strsql.Append(" sum(ta.itotalapply) as itotalapply ")
strsql.Append(" from T_APPLY_RGCB ta ")
strsql.Append(" where ta.iyear='" & iyear.Trim & "' ")
strsql.Append(" and ta.cdepcode in (select cdepcode from v_department where cdeptype='預算主體' connect by prior cdepcode=cdepclasscode start with cdepcode in('" & cdepcodes.Trim & "')) ")
strsql.Append(" and ta.cfeeitemcode in (select cfeeitemcode from v_feeitems where blast='Y' connect by prior cfeeitemcode=cupfeeitemcode start with cfeeitemcode in (select cfeeitemcode from t_fee_config where cfeetypecode='" & cfeetypecode.Trim & "')) ")
strsql.Append(" group by ta.cfeeitemcodefirst,ta.cfeeitemnamefirst,ta.cfeeitemcodesecond,ta.cfeeitemnamesecond,ta.cfeeitemcodethird,ta.cfeeitemnamethird ")
strsql.Append(" order by ta.cfeeitemcodefirst,ta.cfeeitemnamefirst,ta.cfeeitemcodesecond,ta.cfeeitemnamesecond,ta.cfeeitemcodethird,ta.cfeeitemnamethird ")
Return DbHelperSQL.Query(strsql.ToString).Tables(0)
End Function
uj5u.com熱心網友回復:
這里的“cdepcodes”引數是多個部門編碼,需要用單引號挨個處理了一下,hidDepCode.Value = hidDepCode.Value.Trim.Replace(",", "','")
Dim dt As DataTable = bll.Get_ApplyList_RGCB(ddl_year.SelectedValue, hidDepCode.Value, ddl_feetype.SelectedValue)
uj5u.com熱心網友回復:
根本沒出現DataAdapter,貼個毛代碼!轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/98203.html
標籤:VB基礎類
上一篇:this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);這句是什么意思,有什么作用
下一篇:vb6.0連接mysql
