Date Comparison
I am comparing a created date to a result from a database and am unable to get them to agree. Several drop down boxes provide integer values for month/date/year that insert into the database correctly. Before running the insert, I search the DB for a Date value equal to the value about to be inserted and cannot get the comparison to work correctly.
Code Segments:
var Month = new String (Request.Form("Month"));
var Date = new String (Request.Form("Date"));
var Year = new String (Request.Form("Year"));
var InsertDate = Month + "/" + Date + "/" + Year;
SQL = "INSERT INTO NurseryEvent (EventDate, ServiceID) VALUES ('"
SQL = SQL + InsertDate
SQL = SQL + "', "
SQL = SQL + ServiceDescriptionID
SQL = SQL + ")";
adoConnection.Execute(SQL);
Above code works correctly. When I try to add a Select/check function before the insert command, the comparisons fail:
SQL = "SELECT * FROM NurseryEvent ";
SQL = SQL + " WHERE EventDate = " + InsertDate;
RS = adoConnection.Execute(SQL);
EventDate NEVER seems to equal InsertDate
Help!!??
Rich
__________________
Ego is a faithful friend; He stays with us all the way to the crater.
|