Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > VB Classic

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 11-01-2009, 11:30 PM
Drew_gable Drew_gable is offline
Registered User
 
Join Date: Sep 2004
Location: Northampton,United Kingdom
Posts: 219
Problem with SQL Select command

hi all,

can someone please help me I am having problems with this SQL Select command

Code:
SQLCommand = SQLCommand & "WHERE JournalDate Between '" & FrmJournalRoll1.txtStartDate.Text & "' AND '" & FrmJournalRoll1.txtEndDate.Text & " AND PoSNumber='" & FrmJournalRoll1.txtPoS.Text & "'"
If I enter in example 12/10/2009 in both the txtstartDate (text box) and 12/10/2009 it finds everything with no errors.

BUT if I enter a wide date range say 01/09/2009 to 20/09/2009 it is finding dates from 01/01/2007 and 01/01/2009 can someone please point out where I am going wrong?

Thanks
__________________
Drew

EPoS made simple
www.jasonpos.co.uk | www.jasonpos.com
Reply With Quote
  #2  
Old 11-02-2009, 05:18 PM
gibra's Avatar
gibra gibra is offline
Registered User
 
Join Date: Mar 2009
Location: Italy - Breganze (VI)
Posts: 75
Database?
Date format?
Reply With Quote
  #3  
Old 11-02-2009, 10:45 PM
Drew_gable Drew_gable is offline
Registered User
 
Join Date: Sep 2004
Location: Northampton,United Kingdom
Posts: 219
Database is SQL Server 2005 Express
date format is DD/MM/YYYY (eg 01/11/2009)
__________________
Drew

EPoS made simple
www.jasonpos.co.uk | www.jasonpos.com
Reply With Quote
  #4  
Old 11-03-2009, 10:31 AM
gibra's Avatar
gibra gibra is offline
Registered User
 
Join Date: Mar 2009
Location: Italy - Breganze (VI)
Posts: 75
Show the whole SQLCommand string value ...
Reply With Quote
  #5  
Old 11-03-2009, 11:05 AM
Drew_gable Drew_gable is offline
Registered User
 
Join Date: Sep 2004
Location: Northampton,United Kingdom
Posts: 219
SELECT * from JournalRoll WHERE JournalDate Between '01/09/2009' AND '20/09/2009' AND PoSNumber='001'

this is what is printed in the debug window
__________________
Drew

EPoS made simple
www.jasonpos.co.uk | www.jasonpos.com

Last edited by Drew_gable; 11-03-2009 at 11:09 AM.
Reply With Quote
  #6  
Old 11-03-2009, 04:41 PM
gibra's Avatar
gibra gibra is offline
Registered User
 
Join Date: Mar 2009
Location: Italy - Breganze (VI)
Posts: 75
Quote:
Originally Posted by Drew_gable View Post
SELECT * from JournalRoll WHERE JournalDate Between '01/09/2009' AND '20/09/2009' AND PoSNumber='001'

this is what is printed in the debug window
OK, the SQL string seem to be correct.
JournalDate is a String or Date field type?
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
data environment SQL command helme_syahiemie VB Classic 4 09-05-2007 04:11 PM
How do I find duplicate records? Nancy Database 2 01-11-2002 10:38 PM
SELECT INTO..# performance in SQL 7.0 David Miller Database 1 01-18-2001 06:33 PM
Re: Sort problem in MS SQL Server 7.0 D. Patrick Hoerter Database 1 06-26-2000 05:57 PM
Urgent please... --- getting deadlock error..when using activex dll in VC++ Chandra VB Classic 0 06-22-2000 08:30 AM


All times are GMT -4. The time now is 08:25 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.