I have an SQL table of records from 2006-2007 and I want to select a range of records based upon start and stop dates entered into text boxes.
I'm using Visual Web Developer; SQL Express; Express Management Studio; VB backcoding
Here's my statement:
SELECT [ID], [BILLNUMBER], [CHARGEDATE], [LNAME], [FNAME] FROM [TABLETracking] WHERE (([CHARGEDATE] IS NOT NULL) AND ([CHARGEDATE] >= @CHARGEDATE) AND ([CHARGEDATE] <= @CHARGEDATE2) AND ([7CAT] = @7CAT))
So, the @CHARGEDATE and @CHARGEDATE2 values are coming from textbox dates that are entered. @7CAT is a value from a user-select dropdown list.
However, a start and stop date such as 01/01/2007 to 12/31/2007 will also return records from the year 2006 (arrrghhhh!...frustrating). How can I make this work? I know there is a BETWEEN statement that can be used, but I am unable to get anything to work..... maybe my parentheses are not structured correctly. Thanks for any assistance.