Help-ColdFusion - enabling a user to search for records in a database by entering a startand end date - (CREATEODBCDATE)

I want to enable a user to enter a start and end date to
define the period they want to search for records of members who
joined on certain dates. Funny thing is...I've got it to work half
of the time. For e.g. I have 4 records between 26/10/2005 and
1/08/2006. When I enter 01/01/2005 as startDate and 31/08/2006 as
endDate, I get the 4 records. However, if I alter the endDate to
01/09/2006 I get every record in the database!!!??? Why's this? I
can't get my head around it!
Here's my code:
First the code for the form the user input the search
criteria on:
<html>
<body>
<FORM action="memberJDateSearch.cfm" method="post">
<p>Start Date: <input type="text"
name="startDate">
<br>End Date: <input type="text" name="endDate">
<input type="reset" value="Clear">
<input type="submit" value="Submit">
</FORM>
</body>
</html>
Simple enough. Now the code for the process and display page:
<html>
<body>
<cfquery name="memberJDateSearch"
datasource="jpkelle2-access">
SELECT *
From members
WHERE ((joinDate BETWEEN #CreateODBCDate(startDate)# AND
#CreateODBCDate(endDate)#))
</cfquery>
<table border=1 bgcolor="beige" cellpadding="3"
cellspacing="0">
<tr>
<th>Member ID</th>
<th>Name</th>
<th>Sex</th>
<th>Date of Birth</th>
<th>Address</th>
<th>Email</th>
<th>Date Joined</th>
</tr>
<CFOUTPUT Query="memberJDateSearch">
<tr>
<td><center>#memberID#<center></td>
<td width="15%">#forename# #initial#
#surname#</td>
<td>#sex#</td>
<td width="10%">#disp('#dob#')#</td>
<td>#address#, #town#, #county#, #postCode#</td>
<td>#email#</td>
<td width="10%">#disp('#joinDate#')#</td>
</tr>
</CFOUTPUT>
</table>
<hr><p>End of members list.</p>
</body>
</html>
any ideas? please help me.

Try formatting your dates first (before the CreateODBCDate
call). I just tried this on my test page and it worked properly. I
removed the DateFormat calls, keeping the dates in your format and
it didn't work. See if something like the following will help:
<cfset startDate =
DateFormat("31/01/2006","dd/mm/yyyy")/>
<cfset endDate =
DateFormat("01/09/2007","dd/mm/yyyy")/>
<cfquery name="memberJDateSearch"
datasource="jpkelle2-access">
SELECT *
From members
WHERE ((joinDate BETWEEN #CreateODBCDate(startDate)# AND
#CreateODBCDate(endDate)#))
</cfquery>

Similar Messages

  • Search for records in the event viewer after the last run (not the entire event log), remove duplicate - Output Logon type for a specific OU users

    Hi,
    The following code works perfectly for me and give me a list of users for a specific OU and their respective logon types :-
    $logFile = 'c:\test\test.txt'
    $_myOU = "OU=ABC,dc=contosso,DC=com"
    # LogonType as per technet
    $_logontype = @{
        2 = "Interactive" 
        3 = "Network"
        4 = "Batch"
        5 = "Service"
        7 = "Unlock"
        8 = "NetworkCleartext"
        9 = "NewCredentials"
        10 = "RemoteInteractive"
        11 = "CachedInteractive"
    Get-WinEvent -FilterXml "<QueryList><Query Id=""0"" Path=""Security""><Select Path=""Security"">*[System[(EventID=4624)]]</Select><Suppress Path=""Security"">*[EventData[Data[@Name=""SubjectLogonId""]=""0x0""
    or Data[@Name=""TargetDomainName""]=""NT AUTHORITY"" or Data[@Name=""TargetDomainName""]=""Window Manager""]]</Suppress></Query></QueryList>" -ComputerName
    "XYZ" | ForEach-Object {
        #TargetUserSid
        $_cur_OU = ([ADSI]"LDAP://<SID=$(($_.Properties[4]).Value.Value)>").distinguishedName
        If ( $_cur_OU -like "*$_myOU" ) {
            $_cur_OU
            #LogonType
            $_logontype[ [int] $_.Properties[8].Value ]
    #Time-created
    $_.TimeCreated
        $_.Properties[18].Value
    } >> $logFile
    I am able to pipe the results to a file however, I would like to convert it to CSV/HTML When i try "convertto-HTML"
    function it converts certain values . Also,
    a) I would like to remove duplicate entries when the script runs only for that execution. 
    b) When the script is run, we may be able to search for records after the last run and not search in the same
    records that we have looked into before.
    PLEASE HELP ! 

    If you just want to look for the new events since the last run, I suggest to record the EventRecordID of the last event you parsed and use it as a reference in your filter. For example:
    <QueryList>
      <Query Id="0" Path="Security">
        <Select Path="Security">*[System[(EventID=4624 and
    EventRecordID>46452302)]]</Select>
        <Suppress Path="Security">*[EventData[Data[@Name="SubjectLogonId"]="0x0" or Data[@Name="TargetDomainName"]="NT AUTHORITY" or Data[@Name="TargetDomainName"]="Window Manager"]]</Suppress>
      </Query>
    </QueryList>
    That's this logic that the Server Manager of Windows Serve 2012 is using to save time, CPU and bandwidth. The problem is how to get that number and provide it to your next run. You can store in a file and read it at the beginning. If not found, you
    can go through the all event list.
    Let's say you store it in a simple text file, ref.txt
    1234
    At the beginning just read it.
    Try {
    $_intMyRef = [int] (Get-Content .\ref.txt)
    Catch {
    Write-Host "The reference EventRecordID cannot be found." -ForegroundColor Red
    $_intMyRef = 0
    This is very lazy check. You can do a proper parsing etc... That's a quick dirty way. If I can read
    it and parse it as an integer, I use it. Else, I just set it to 0 meaning I'll collect all info.
    Then include it in your filter. You Get-WinEvent becomes:
    Get-WinEvent -FilterXml "<QueryList><Query Id=""0"" Path=""Security""><Select Path=""Security"">*[System[(EventID=4624 and EventRecordID&gt;$_intMyRef)]]</Select><Suppress Path=""Security"">*[EventData[Data[@Name=""SubjectLogonId""]=""0x0"" or Data[@Name=""TargetDomainName""]=""NT AUTHORITY"" or Data[@Name=""TargetDomainName""]=""Window Manager""]]</Suppress></Query></QueryList>"
    At the end of your script, store the last value you got into your ref.txt file. So you can for example get that info in the loop. Like:
    $Result += $LogonRecord
    $_intLastId = $Event.RecordId
    And at the end:
    Write-Output $_intLastId | Out-File .\ref.txt
    Then next time you run it, it is just scanning the delta. Note that I prefer this versus the date filter in case of the machine wasn't active for long or in case of time sync issue which can sometimes mess up with the date based filters.
    If you want to go for a date filtering, do it at the Get-WinEvent level, not in the Where-Object. If the query is local, it doesn't change much. But in remote system, it does the filter on the remote side therefore you're saving time and resources on your
    side. So for example for the last 30 days, and if you want to use the XMLFilter parameter, you can use:
    <QueryList>
    <Query Id="0" Path="Security">
    <Select Path="Security">*[System[TimeCreated[timediff(@SystemTime) &lt;= 2592000000]]]</Select>
    </Query>
    </QueryList>
    Then you can combine it, etc...
    PS, I used the confusing underscores because I like it ;)
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • Search for records in a table on the basis of a function

    Hi,
    How is it possible to use a function as search criteria in a sql query ?
    For example, I have the following query :
    select a.job_name JOB_NAME, substr(a.job_name,instr(a.job_name,'.',-1)+1) as AUTNAME
    FROM autosys.job a
    where a.job_name like %PRD%' and a.command like '%dsjob%'
    and a.command not like 'substr(a.job_name,instr(a.job_name,'.',-1)+1)';
    This is now working because of the use of function "substr" on the right side of the query.
    How can I write the query so as to find the same result as using this function ?
    Can someone help me out on this ?
    Thanks

    Among other things, you have the quotes in the wrong place in the NOT LIKE predicate. As posted, you are searching for records where command does not contain the literal string substr(a.job_name,instr(a.job_name,'.',-1)+1). I don't think that is really what you are after. You need to concatenate the operators to the results of the SUBSTR function. Something more like:
    SELECT a.job_name job_name,
           SUBSTR(a.job_name, INSTR(a.job_name, '.', -1)+1) as autname
    FROM autosys.job a
    WHERE a.job_name LIKE 'HP.TM.%PRD.%' and
          a.command LIKE '%dsjob.sh%' and
          a.command NOT LIKE '%'||SUBSTR(a.job_name, INSTR(a.job_name, '.', -1)+1)||'%'; John

  • Search for records by Remote Key or Remote System in Data Manager

    Hi all,
    We have a requirement to search for records by Remote key and/or Remote System at the main table level. Is it possible to do this using the Data Manager? If so, how?
    Thanks in advance!
    Lavanya.

    Hi,
    I crosschecked with MDM 5.5 and Don't think it is possible through Data Manager. How ever using APIs you can search records using remote key/ remote system.
    Regards,
    Shiv

  • Player Error: "You cannot record without enabling at least one track for recording"

    So I'm trying to adjust my audio using the track mixer in premiere pro cc. I assigned 2 clips to a submix. When I tried to record, I got the following error: "You cannot record without enabling at least one track for recording." I disabled other tracks, then re enabled them all, muted them all, but still got the same error when I tried to record.

    This is how I have just made a recording:
    Select track to record (1), Select record (2) then press play to record.
    Use the in-out markers in the program monitor to select the area to record.

  • Single User Mode: Searching for root...

    My 2 year old unplugged my PowerMac iMac G5 (single) and now it won't start up.
    I was finally able to boot up off of Disk Warrior and replace the directory, but it won't start up past the gray Apple screen. The fan comes on after about 45 seconds and blows hard. Then, I get the circle with a line through it, in gray. I've never seen that on a mac.. the international "no" sign.
    When trying to start up in Single User Mode, I get a long list of stuff either disabled, not found, missing etc and then it starts writing to the screen every 30 seconds a line like:
    Still searching for root.
    I've tried pulling the back off, resetting the SMU, starting up in Safe Mode, etc.
    This has happened with storms before and I can usually get it back.
    I don't have original install discs.

    When you say you have "OSX" but not the "original install disks" do you mean the mac originally came with an earlier version and you don't have those disks, but you have a retail copy of Tiger?
    The circle with the slash means that Open Firmware cannot find BootX. Basically, I think this means that Open Firmware recognises the startup volume as such but cannot hand control to the operating system at all. BootX is what it uses to get the operating system going. Without this, as you've seen, you cannot make even single-user mode.
    What is SMU?
    *Is your data backed up? If not, prioritise that unless you can afford to loose it.*
    Does DiskWarrior repair permissions? If not and you have the Tiger retail version, try running Disk Utility to do that. I don't think this will help, but it won't hurt.
    Do you have another Mac? If so and you have the retail Tiger, you might be able to use Pacifist to replace BootX (in /System/Library/CoreServices). Alternatively, if the other Mac is running the same version of the OS and is also a PPC Mac, you could try copying the file from that machine.
    Before you do any of this (with the exception of the permissions repair), try to backup any data you need if that's at all possible.
    - cfr

  • Correct User Exit search  for a Buisness Process..

    Hi Team,
    Can someone please explain me how should i go about to search for the correct User Exit running behind a Process(A buisness Process )  which would require certain enhancements ..
    Thanks .
    Regards,
    SK

    Hi,
    Go to SE93, and give the t.code which you want
    Then take the package and go to SMOD
    There click F4 for enhancements, then click on information system, there you give package and enter
    Now, you will get corresponding exits.
    this is one way.
    other way is  we need to check whole program or exit
    go to that t.code, goto system -->status .There find out the prog name.
    Then double click the program name.
    In attributes  teb, you find the package.
    go to SMOD, press F4 and input package
    Hope this helps
    Regards,
    Anbu

  • The Help Tab (OSX ML) where you search for something does not work

    If I click "Help" and then search "expand" it will show me where expand is. But in CS6 when I clicked it the command would go through and pull up the page to expand pixels. Instead, I have to go find it. It works in every other Adobe app I use except Photoshop CC.
    I am on the latest version and on CC

    Hi Peter
    Thanks a lot for your help (and sorry for not having answered quicker, but my boss gave me a more urgent task last week...).
    Anyway, I did what you suggested (re-importing into a brand new project), and then the search for synonyms really worked! But, being a sceptical person, I did the same with another project, and with that one, it did not work. So, what I did next was compare all the settings of these two projects, and I found a difference.
    RH8 now contains a function that's called 'Teilzeichenfolgensuche' (I don't know the English expression, but have a look at the attached picture: this is a screen shot from the second page when I generate WebHelp). After having done several tests, I came to the following conclusions:
    Search for synonyms does not work in HTML-Help, but it does work in WebHelp (and maybe others, but they are not relevant for me, so I did not test them);
    Search for synonyms does only work, when the function 'Teilzeichenfolgensuche' is NOT activated.
    Could maybe somebody test this, too, and post here whether my conclusions are really correct?
    Btw: This fact is not mentioned in the RH-Manual; actually, this function 'Teilzeichenfolgensuche' is not even mentioned there (at least not in the German edition)!!!
    Can hardly wait to see your feedback; thanks again for everybody's support!
    Kurt

  • Need help showing singles and albums after searching for them In I Tunes 11 Win 7

    Just got I tunes 11 iusing Win 7 and when I add songs and search for them in the upper right hand corner the album or the song appears. NowI need to view the single so I can add info. But I cannot figure out where to click to jump to that single shown in the main display or the album shown in the main display window. Can somebody please help me? What to you click on? Thanks in advance. Also where are your playlists?

    I wanted to bring closure to this unanswered thread. I came to realize that I put way too much into that post (information overload) and couldn't possibly expect for anyone to take on such a compilation of driver issues all at once. I later put each issue into separate threads and then got the help I needed. I learned how to find out what the Hardware ID was for each one and got the appropriate software driver to match.
    Kudos go to Jerry_Lippey who helped me out in so many ways plus gave me the link to a page where I learned how do do this myself.
    That can be seen here: How to identify an unknown device (e.g. Wireless LAN module)?
    And, you can look up Hardware ID's here: PCI Vendor and Device Lists
    I hope this helps someone in the future who is the same boat that I was once in.

  • Search for tablenames in the database using native sql query script

    How do i search for the names of the tables in the database using select statement? I do not know the names of the tables but I know the name of the database and i do not have the sys priviliges.
    thanks
    SS

    SELECT owner, table_name
    FROM all_tables;

  • Help with enabling TPM in Task Sequence for Dell Laptops

    Hi there,
    I would appreciate some advice on creating a task sequence for Win8.1 with TPM enabling for Dell laptops; I have BitLocker set up manually with a Group policy, but want to have TPM enabled in the task sequence. I have read older posts on sites such as windows
    noob, but can't see how to reference the CCTK and get TPM going for win8.1 in a SCCM2012 environment. 
    Obviously I haven't created this before so any help would be appreciated; I have noticed when I try to import my CCTK configurations into SCCM as it isn't a zip file I cannot do it.

    Luckily Dell wrote a whitepaper about that subject, see:
    http://en.community.dell.com/techcenter/extras/m/white_papers/20209083
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • HT1528 How to enable root user using terminal for mac lion 10.7.5 (step by step)

    I been trying to find the terminal version of creating a root user since I don't know my admin password and want to delete that user.

    You don't need to enable the root user. Just change the password for the account.
    Forgot Your Account Password
    For Lion, Mountain Lion, or Mavericks
        Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
         When the menubar appears select Terminal from the Utilities menu.
         Enter resetpassword at the prompt and press RETURN. Follow
         instructions in the dialog window that will appear.
         Or see:
           Reset a Mac OS X 10.7 Lion Password
           OS X Mountain Lion- Reset a login password,
           OS X Mavericks- Solve password problems,
           OS X Lion- Apple ID can be used to reset your user account password.
    For Snow Leopard and earlier with installer DVD
         Mac OS X 10.6- If you forget your administrator password,
         OS X- Changing or resetting an account password (Snow Leopard and earlier).
    For Snow Leopard and earlier without installer DVD
        How to reset your Mac OS X password without an installer disc | MacYourself
        Reset OS X Password Without an OS X CD — Tech News and Analysis
        How To Create A New Administrator Account - Hack Mac

  • Any chance to improve ios8 to help iBooks or make users dump iBooks for ever

    Any improvements will be made in the ios8 for a usable software for iBooks or users have no option but to dump this app and live with it

    It might be a corrupt app ... reload the app through the reset to factory condition ...
    Back up and Restore your iOS Device with iCloud or iTunes 
    http://support.apple.com/kb/ht1766
    iTunes: About iOS Backups
    http://support.apple.com/kb/ht4946
    Use iTunes to Restore your iOS Device to Factory Settings
    http://support.apple.com/kb/ht1414
    Be sure to do your backups first, and if you 're using iCloud backup, then you'll have to backup your PDFs and other non-Apple books and documents separately.

  • Help with creating a user input BTree for hierarchy structure

    I have been trying to create code that takes a user input string
    ex: a:b,c;b:g,h,j;g:k,m;b:u
    note: (the above string is then stored into a string array such in the format a:bc;b:ghj;g:km;b:u after it is verified that the hierarchy order is correct)
    The string is read in such that the any value before the : is a parent and its childern continue until a ; is found. Anyway verifying the sting I have accomplished and I have been able to input the string into a modified binary tree as long as there are only 2 childern per parent and graphically represents its structure of hierarchy. The problem is that each parent can have more the two childern.
    I have been working with the BTree class and find its output similar to what I am wanting which would represent a hierarchy of objects (files, employees, etc...) anyway I have been stumped as to how to get the above string into a format that can then create the correct BTree output without hard code.
    If any one has any suggestions on how to turn the data, in the string array into a usable format to create the correct BTree output, I would greatly appreciate it.
    In the above example the string array, a:bc;b:ghj;g:km;b:u would have a desired ouput of
    a
    ..b
    ....g
    ......k
    ......m
    ....h
    ....j
    ....u
    ..c
    Thanks
    Shane

    OOPS! I ment to say JTree not BTree

  • Search for record in txt and print to console

    QairNo: 21, PostCd: 12, Age: 21, Gender: 2, Q1Res: 1, Q2Res: 2, Q3Res: 3,
    QairNo: 23, PostCd: 21, Age: 12, Gender: 2, Q1Res: 1, Q2Res: 2, Q3Res: 3,
    QairNo: 32, PostCd: 32, Age: 12, Gender: 1, Q1Res: 2, Q2Res: 1, Q3Res: 2, Hi i manage to write the above entry into database.txt
    now i need to search and print the particular data i need. For example i enter *21* and it will print all the attribute that belong to it.
    Please forgive me i am new to this, i have google for example but i can`t apply them for some reason. Below are my code, thank you for helping out !
    public class PollSummary {
         public static void main (String args[]) throws IOException {
              //int inputQuestionNum= 0;
              String key = "QairNo: ";
              Scanner input = new Scanner(new FileReader("polldata.txt"));
              while(input.hasNextLine()){
                   System.out.println(input.nextLine());
              //System.out.println("Enter the Questionnaire Number to view records");
              //inputQuestionNum = Integer.parseInt(entry.nextLine());
               while (input.hasNext() && input.findInLine(key) != null)
                     String fileLine = input.nextLine();
                     System.out.println(fileLine);
         }//end main
    }//end class

    You should use a map, just use the QuairNo as a key (aside: what is a Quair?)
    http://java.sun.com/docs/books/tutorial/collections/interfaces/map.html

Maybe you are looking for