更新:
{SELECT * FROM FCR.V_REPORT WHERE DATE BETWEEN to_date('14/09/2001','dd/mm/yyyy') AND to_date('30/09/2011','dd/mm/yyyy')}
如果删除大括号并在导航器中将其发布,则可以正常工作.
原版的:
我在运行程序时遇到问题. sql navigator中的查询返回192行,但是当我在c#(visual studio 2010)上运行查询时,查询返回0行.
下面是我的c#代码:
public static DataTable GetReport(string date1,string date2) { DatabaseAdapter dba = DatabaseAdapter.GetInstance(); string sqlQuery = string.Format(@"SELECT * FROM FCR.V_REPORT WHERE DATE BETWEEN to_date('{0}','dd/mm/yyyy') AND to_date('{1}','dd/mm/yyyy')",date1,date2); OracleDataReader reader = dba.QueryDatabase(sqlQuery); DataTable dt = new DataTable(); dt.Load(reader); int temp = dt.Rows.Count; return dt; }
这是我在sql navigator中使用的查询(返回192行):
SELECT * FROM FCR.V_REPORT WHERE DATE BETWEEN to_date('01/01/2001','dd/mm/yyyy') AND to_date('30/09/2011','dd/mm/yyyy')
解决方法
尝试删除视图并再次创建.确保你的别名也正确.