I'm executing a stored procedure that filters on datetime input parms. This is the procedure:
Input parms: @ai_d_startdate (datetime), @ai_d_enddate (datetime)
When I run from CAST SQL Builder (a query analyzer) I get the result set I expect, but when I execute via ADO 2.5, I get an opened Recordset with no records.
I tried setting Parameter types to adDate and adDBDate, but no effect.
The value that the Parameter object is sending to the DB is #1/27/1997 8:00:00 AM#.
No errors are generated on execution.
Any ideas?
Input parms: @ai_d_startdate (datetime), @ai_d_enddate (datetime)
Code:
-- If no end time, default to 1-hour block of time
if @ai_d_enddate is null
select @ai_d_enddate = DATEADD(hh, 1, @ai_d_startdate)
-- Convert input parms to compatible format
select @ai_d_startdate = convert(datetime, @ai_d_startdate, 110) --101)
select @ai_d_enddate = convert(datetime, @ai_d_enddate, 110) --101)
-- Constant for Therapist provider type/category
declare @PROVIDER_TYPE_THERAPIST int
select @PROVIDER_TYPE_THERAPIST = 2
Select s.VisitDateTime, s.PatientSchedID,
s.ServiceID,
p.Firstname + ' ' + p.lastname 'PatientName',
s.VisitReason,
r.firstname + ' ' + r.lastname 'TherapistName'
From Patient p,
Patient_schedule s,
provider r
Where p.patientId = s.patientId and
r.providerId = s.providerId and
r.ProviderTypeID = @PROVIDER_TYPE_THERAPIST and
s.VisitDateTime between @ai_d_startdate and @ai_d_enddate
I tried setting Parameter types to adDate and adDBDate, but no effect.
The value that the Parameter object is sending to the DB is #1/27/1997 8:00:00 AM#.
No errors are generated on execution.
Any ideas?