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.
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)

Open in new window

LVL 11
G0ggyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dampseyCommented:
do you have any try catch blocks with an empty catch? if this is the case, you may get an exception but don't be notified???

or check your connection string may be your are connecting to a different server? with a unupdated data with the same structure?
0
G0ggyAuthor Commented:
No, sorry, it is the same DB server and there is no TCF block.
0
dampseyCommented:
can you please try without the c1.startDate condition?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

G0ggyAuthor Commented:
Yep it's the c1.startDate condition that is not working, bit confused as to why as it used to work fine?
0
dampseyCommented:
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
0
G0ggyAuthor Commented:
Hmm, that is a concern as, eventually, this will be a global site...
0
G0ggyAuthor Commented:
I solved with using getDate(), how simple, how annoying, you can have the points for getting me in the right direction, cheers.
0
dampseyCommented:
thanks ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.