hi
im pretty new to coding with javascript and am having some problems with pulling some data from a MS Access DB based on a date:
My code:
Code:var strSQL; var strPattern; var rsKeyword; var nowDate = new Date(); strSQL = "SELECT * FROM tbl_Holidays " + "WHERE tbl_Holidays.HolidayDate = " + nowDate.getDate() + "/" + (nowDate.getMonth() + 1) + "/" + nowDate.getYear() + ";" rsKeyword = new ActiveXObject( "ADODB.RecordSet" ); rsKeyword.ActiveConnection = CONN_LOOKUPDB; rsKeyword.Source = strSQL; rsKeyword.CursorType = 0; rsKeyword.CursorLocation = 1; rsKeyword.LockType = 1; rsKeyword.Open(); if (!rsKeyword.eof) { delEmail = "non holiday email adddress"; } else { delEmail = "current holiday email adddress"; }
essentially what im trying to acheive is if a record in the DB equals todays date then it is a holiday and to set the variable delEmail appropriatly!
But it never seems to work right, its like its seeing the date different to how im inputting it.
Is there something to do with it needs to be in an american format not uk or something?
Any help greatly appreciated!


Reply With Quote
Bookmarks