G0ggy
asked on
Inconsistent results from command object
Hi all,
I'm looking for pointers here. I have a command which is generated from search options, if I run the command from within my website I get an empty datareader, if I then copy the SQL from SQL Profiler and paste it into a new query window in SQL Server Management Studio I get 1 result back.
How is it possible to have different results from the same command?
TIA.
I'm looking for pointers here. I have a command which is generated from search options, if I run the command from within my website I get an empty datareader, if I then copy the SQL from SQL Profiler and paste it into a new query window in SQL Server Management Studio I get 1 result back.
How is it possible to have different results from the same command?
TIA.
SELECT cl.classID, cl.country, co.countryName, cl.courseID, cm.courseName, cl.startDate, cl.endDate, cl.startTime, cl.endTime, cl.noOfDays, cl.maxDelegates, cl.location, dp.DepotName, cl.extraDetails, cl.instructor, mu.firstName +
' ' + mu.familyName As instructorFullName, cl.hiddenFromDealersStaff, cl.assessmentOptions, cl.createdBy, mu2.firstName + ' ' + mu2.familyName As createdByFullName, cl.createdDate, cl.editedBy, mu3.firstName + ' ' + mu3.familyName
As editedByFullName, cl.lastEditedDate FROM dbo.trn_classes cl Inner Join dbo.usr_countries co On cl.country = co.id Inner Join dbo.trn_coursesMaster cm On cl.courseID = cm.courseID Left Outer Join dbo.usr_depots dp On cl.location
= dp.DepotID Left Outer Join dbo.usr_masterUsers mu On cl.instructor = mu.profileID Left Outer Join dbo.usr_masterUsers mu2 On cl.createdBy = mu2.profileID Left Outer Join dbo.usr_masterUsers mu3 On cl.editedBy = mu3.profileID
Where cm.courseName Like '%basic%' And cl.classStatus = 1 And cl.startDate > Cast('2008-02-11 00:00:00.000' As DateTime)
ASKER
No, sorry, it is the same DB server and there is no TCF block.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yep it's the c1.startDate condition that is not working, bit confused as to why as it used to work fine?
this may be because of your reginal settings may be?
you know. the most problamatic thing with dates are
year, month, day
or
year, day, month
you know. the most problamatic thing with dates are
year, month, day
or
year, day, month
ASKER
Hmm, that is a concern as, eventually, this will be a global site...
ASKER
I solved with using getDate(), how simple, how annoying, you can have the points for getting me in the right direction, cheers.
thanks ;)
or check your connection string may be your are connecting to a different server? with a unupdated data with the same structure?