I am converting an application that was written in VB to C#. I am trying to test this query to pull data from Oracle. This query gives me anything = or > STime, but ignores the year.
So if STime = 01/01/2010 12:00:00
I get 01/01/1998 12:00:00, 03/03/1995 11:00:00
I need anything that is greater than STime.
I think that there is just a synxat error and I am not sure what I am missing.
Any help is greatly appreciated!
Thanks,
Chilly442
---------------------------------------
If I lived anywhere else I'd be Sunny442
So if STime = 01/01/2010 12:00:00
I get 01/01/1998 12:00:00, 03/03/1995 11:00:00
I need anything that is greater than STime.
I think that there is just a synxat error and I am not sure what I am missing.
Any help is greatly appreciated!
Code:
string query;
OdbcConnection Con = new OdbcConnection();
DateTime STime;
query = ("SELECT * FROM Events WHERE(Unit = '" + Unit + "')
AND StartTime >= TO_DATE('" + STime + "', 'MM/DD/YYYY HH:MI:SS')");
try
{
OdbcCommand CMD = new OdbcCommand(query, Con);
OdbcDataAdapter da = new OdbcDataAdapter();
da.SelectCommand = CMD;
Con.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Events");
GridView1.DataSource = ds;
GridView1.DataBind();
Con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Thanks,
Chilly442
---------------------------------------
If I lived anywhere else I'd be Sunny442