我正在尝试使用 C# 从我的 Oracle 数据库 BY DATE 中选择数据。但是我总是得到一个空数据集,尽管相同的查询字符串在 Oracle SQL Developer 中工作得很好
String Query = "Select position_date from position";
OracleDataAdapter adapter = new OracleDataAdapter(Query, ocon);
adapter.Fill(ds, "table"); //where ds is a dataset
PrintDataSet(ds);
返回
3/8/2011 12:00:00 AM.... and more
但是,当我将查询更改为以下时,就没有输出了!
String Query = "Select position_date from position
where to_char(position_date, 'mm-dd-yyyy') = '05-17-2012'"
此查询在 oracle sql developer 中运行良好。我也尝试过 trunc(sysdate) 但似乎没有任何效果!:(