What I'm trying to do is to execute the query between two dates, and the dates would come from a parameter.
In the below code, I'm putting one parameter and letting the second date as fixed just for example purposes.
The code / query is kind of long to paste it here, but here is a short version:
OracleParameter fromDateParameter = new OracleParameter();
fromDateParameter.OracleDbType = OracleDbType.Varchar2;
fromDateParameter.Value = "'3/06/2013 20:00:00'";
this.oracleDataAdapter4.SelectCommand = new OracleCommand("
SELECT DISTINCT (LOG.RID) FROM LOG WHERE LOG.TIMESTAMP
BETWEEN TO_DATE(:fromDateParameter, 'MM/DD/YYYY hh24:mi:ss ')
AND TO_DATE('3/06/2013 23:59:00', 'MM/DD/YYYY hh24:mi:ss '))",
oracleConnection4);
oracleDataAdapter4.SelectCommand.Parameters.Add(fromDateParameter);
this.oracleDataAdapter4.Fill(event11);
And I got this message:
ORA-01858: a non-numeric character was found where a numeric was
expected
I did the same query without the parameter and it works just fine.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…