Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem returing all records from an SQL query using FP web Pages

Status
Not open for further replies.

AndyLord

Programmer
Jun 30, 2004
45
GB
Not sure if I'm in the right forum, but here goes...
I am working on a project, which has been previously developed, using Frontpage 2002, SQL Server 2000.
I have query, saved as stored procedure no SQL SERVER. which will return records between a start and end date. This works fine in SQL SERVER, all records are returned, but when entering the dates on the web pages it will return the records minus 1, in other words either the first or last record is missing. Can not understand why this is happening. Looked at the issue of mm/dd/yyyy and dd/mm/yyyy date formats. Used (CAST(FLOOR(CAST(DATEFIELD AS float)) AS smalldatetime) >= @startDate) for the STARTDATE and ENDDATE. I am completley stuck. Can anyone provide any help with this problem. If any further information is required please inform me.
Example of the query

"SELECT hdk.PHX_Problems.problemID, hdk.PHX_Categories.Category, hdk.PHX_Problems.createDate, hdk.PHX_Problems.Details,
hdk.PHX_Problems.contactName, hdk.PHX_Staff.userName
FROM hdk.PHX_Problems INNER JOIN
hdk.PHX_Staff ON hdk.PHX_Problems.empid = hdk.PHX_Staff.empid INNER JOIN
hdk.PHX_Categories ON hdk.PHX_Problems.categoryID = hdk.PHX_Categories.categoryID
WHERE (CAST(FLOOR(CAST(hdk.PHX_Problems.createDate AS float)) AS smalldatetime) >= @startDate) AND
(CAST(FLOOR(CAST(hdk.PHX_Problems.createDate AS float)) AS smalldatetime) <= @endDate) AND (hdk.PHX_Problems.status = 'Closed')
ORDER BY hdk.PHX_Problems.createDate DESC"

@StartDate and @EndDate are parameters passed from the web page.
The project uses ASP VBScript Class functions/ modules (I'm not the greatest at explaining, which helps hey!) for permissions, db connections etc.
The web pages use VBScript.
Many thanks in advance.
 
This expression:
Code:
(CAST(FLOOR(CAST(DATEFIELD AS float)) AS smalldatetime) >= @startDate)
... compares only date values (hh:mm:ss ignored). It looks good. Can you post entire SP code, plus SQL statement that calls SP (get it with debugger or Response.Write from ASP)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top