Solved

SQL weird

Posted on 2006-11-22
10
162 Views
Last Modified: 2010-04-30
SELECT DISTINCT fldHistoSItemsDate, fldHistoSItemsHeure, fldHistoSItemsEmp
FROM         [Histo - SItems]
WHERE     (fldHistoSItemsSaisie = 144)
ORDER BY fldHistoSItemsDate, fldHistoSItemsHeure



This request returns me 4 result in VB6 but 1300 in SQL Manager... any idea ? not the same format but same value.
0
Comment
Question by:TheSonics
10 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 168 total points
ID: 17999997
In vb I would get it to output the exact query that is being run, then copy that to sql manager and try it.

You may need to address the specific database, also the distinct keyword may be causing you problems.  It should however be behaving the same if the exact same query is sent to it.
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 166 total points
ID: 18001083
can you show us the relevant VB code?
what is the table structure?


like Raynard indicates, the issue might the distinct with the datetime fields, which due to different formatting, might do different results.
you might then have to apply the convert() function around them to force the same output, like:

SELECT DISTINCT convert(varchar(10), fldHistoSItemsDate, 120) as fldHistoSItemsDate#
, convert(varchar(10), fldHistoSItemsHeure, 8) as fldHistoSItemsHeure , fldHistoSItemsEmp
FROM         [Histo - SItems]
WHERE     (fldHistoSItemsSaisie = 144)
ORDER BY 1, 2
0
 
LVL 9

Assisted Solution

by:Naveen Swamy
Naveen Swamy earned 166 total points
ID: 18001309
angelIII  is right,
 also use trace/profiler to check for any errors,
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Expert Comment

by:inthedark
ID: 18006818
What is the data type of fldHistoSItemsSaisie?
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 18074691
I think that you should ask to have your grade re-marked, if none of these solutions gave you your answer then you should have indicated as such - C's should only rarely / if ever be given - read the help files if you are unsure

Additionally since navstar's answer was just agreeing with AngelIII's answer he should be given some of the credit.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18372701
point split Raynard, angelIII, navstar16
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Link a textbox in excel to a cell with more than 255 characters. 5 67
Put text in a picture ASP.NET C# 2 50
Copy a row 12 59
Exit a vb6 apps when a calling it apps closes 15 43
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now