Hi There,I'm having a strange issue getting different results when executing a query in SSMS and C# .Net. The query (EXEC [GetClassDates3015] = 6588) returns 1 row when run via SSMS (2010-07-06 00:00:00.000 06/07/2010 Tuesday )When run via c# .Net I still have 1 row returned, but the dates have incremented by 1 day. The contents of the SP being called is below;set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER PROCEDURE [dbo].[GetClassDates3015] @TimetableDetailID int AS BEGIN DECLARE @Day int, @LecturerID int, @RoomID int, @Start datetime, @End datetime, @AcademicPeriod int, @StreamUnitID int SELECT @Day = [Day], @RoomID = RoomID, @LecturerID = td.LecturerID, @Start = [Start], @End = [End], @AcademicPeriod = S.Period, @StreamUnitID = [StreamUnitID] FROM TimetableDetail td INNER JOIN Stream S ON S.ID = td.StreamID WHERE td.ID = @TimetableDetailID SELECT c.ClassDate, CONVERT (Char(11), c.ClassDate , 103) as 'Date', dbo.DayName(c.ClassDay,0) as 'Day', IsNull(cd.Description,'') as Description FROM dbo.GetClassDates(@TimetableDetailID) c LEFT JOIN CalendarDate cd ON c.ClassDate = cd.Date LEFT JOIN AttendanceClass ac ON c.ClassDate = CAST(FLOOR(CAST(ac.ClassDateTime AS float))AS datetime) AND AttendanceItemID IN (SELECT ID FROM AttendanceItem WHERE TimetableDetailID in (SELECT td.ID FROM TimetableDetail td JOIN TimetableLink tl ON td.ID = tl.TimetableDetailID INNER JOIN Stream S ON S.ID = td.StreamID WHERE [Day] = @Day AND RoomID = @RoomID AND td.LecturerID = @LecturerID AND [start] = @Start AND [End] = @End AND S.Period = @AcademicPeriod AND td.StreamUnitID = @StreamUnitID ) ) WHERE ac.ID IS NULL ORDER BY c.ClassDate END
I've simplified the C# code to a few lines using just the standard .Net controls, but when the results make it into the readed the day has incremented. I've spent a few hours on this already and are getting nowhere. I'm suspecting everything from a bug in the framework to data type issues. Has anyone experienced this before? Can anyone give me some direction?ThanksTim