www.webdeveloper.com
Results 1 to 3 of 3

Thread: SQL Select on ms access db from javascript

  1. #1
    Join Date
    Aug 2009
    Posts
    11

    Exclamation SQL Select on ms access db from javascript

    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!

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Are you sure it's about javascript (known sometimes as JS)? Or it's about server-side javascript (SSJS)? javascript is a client-side language.

  3. #3
    Join Date
    Aug 2009
    Posts
    11
    it must be ssjs as im running the script from a batch file on a server Does that help?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles