gpt4 book ai didi

vb.net - 无法使用 oracledataadpter 填充数据集

转载 作者:行者123 更新时间:2023-12-01 14:37:40 26 4
gpt4 key购买 nike

我遇到了一个非常奇怪的问题,我正在使用下面的一段代码,但是 ds 有时没有填充 ds 中有数据,但并非总是如此,我已更改连接池 并重新启动iis 但一点运气都没有,我无法找到问题出在哪里请帮帮我。我在 TOAD 中运行相同的查询及其给出的结果,如果有任何不一致的地方,我也提交了事务。

 Dim command As New OracleCommand
Dim ds As New DataSet
Try
Using connection As New OracleConnection
(ConfigurationManager.ConnectionStrings("CA").ConnectionString.ToString())
connection.Open()
command.Connection = connection
command.CommandText = "SELECT w.portfolio, w.appl_group,
tm.trng_title, p.tt_program_title," & _
" p.created_date,
p.tt_target_completion_date, p.tt_prog_status," & _
" w.emp_id, w.first_name || ' ' ||
w.last_name, ('Y') training_done_flag," & _
" t.actual_completion_date,
p.created_by, w.people_manager, " & _
" w.project_manager, w.flag" &
_
" FROM tt_training_done_records t," & _
" wsr_employee w, " & _
" tt_training_master tm, " & _
" tt_newprogram p" & _
" WHERE(w.emp_id = t.employee_id)" & _
" AND t.training_info_id = tm.trng_id"
& _
" AND p.tt_program_id(+) =
t.program_id" & _
" AND tm.trng_id IN ( 'TT_009' ) " & _
" AND t.actual_completion_date BETWEEN
TO_DATE('11-Mar-2009') AND TO_DATE('11-Mar-2013') " & _
" "

Dim adpt As New OracleDataAdapter(command)
adpt.AcceptChangesDuringFill = False
adpt.Fill(ds)
connection.Close()
End Using

最佳答案

不要依赖将字符串转换为日期的默认行为。使用日期文字或提供格式字符串参数。这引入了对您的 .NET 代码不应依赖的 NLS 环境设置的依赖。

代替 TO_DATE('11-Mar-2013')

尝试 date '2013-03-11'TO_DATE('11-Mar-2013'), 'DD-Mon-YYYY')

关于vb.net - 无法使用 oracledataadpter 填充数据集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15337775/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com