Date comparison does not work correctly??

L

Lloyd Sheen

Below is the output from command window. This shows values of variables and
result of comparison.

Make no sense except to dot.net.

Any ideas??

?pofile
#11/11/2003 12:39:22 PM#
?pdtdbdate
#11/11/2003 12:39:22 PM#
?pofile=pdtdbdate
False

Lloyd Sheen
 
E

emg

It's possible that the display format lacks the same level of precision as
the actual variables. In other words, var1 may have hours, minutes, seconds
and hundreths of seconds while var2 either doesn't have hundredths of
seconds :)00) or the hundredths value differs.
 
L

Lloyd Sheen

Full path of the date is -
1. Scan all files in several folders
2. Store date of last change in SQL Server
3. Retrieve date from SQL Server and compare to last change date of file

It is so hard to believe that data-in is not equal to data-out.

With dot.net everything that should be simple (at least according to MS) is
not.

Lloyd Sheen
 
E

emg

You're assuming too much. You're reading in a timestamp from a file system,
storing it into a variable, passing it to SQL and storing it in a database.
Have you looked at the value:
a) on the file system
b) once it's in your .Net variable
c) once you've passed it to SQL (is it a stored procedure with a datetime
data type? a string datatype? or a straight SQL statement?
d) stored it in a sql variable (again, a dateTime? a smallDateTime? a
string?)

I've had problems in web pages passing dates back to SQL and losing
precision. It's not just "dotnet", it's the file system, dotnet and SQL all
passing data back and forth. This may not be the source of your problem but
I would certainly look at it more closely.
 
C

Cor

Hi Lloyd,

Why you make it us so difficult to help you.

Now you are talking that it is about two different kinds of dataformats that
was the date comparissing about.

While I could not understand what could wrong, because you first presenting
it as strings or at least the same dataformats.

Do you have more hidden things in your solution from which we hear
afterwards?

Just my thoughts,

Cor
 
L

Lloyd Sheen

That is what I ended up doing. If I check as poFile.ToString then there is
no problem.
 
L

Lloyd Sheen

No hidden things. As in next post, comparing as strings fixes the problem.
It would be nice if data in matched the data out.

I am getting a value from System.IO for last updated time and storing it in
SQL Server. When I retrieve it to compare against the original (in most
cases) it is not the same. This is the problem. This kinda takes away from
the idea that what I store can be retrieved later and used to determine
processing paths.

I apologize if you think I am difficult. I just spent a weekend working
(fighting) with the IDE and all these problems do not help. What was a
simple implementation conceptually ends up taking twice the time and way too
many workarounds for me.

I appreciate all the help others give and if you notice I have answered
postings when I know the answer or a workaround.

Lloyd Sheen
 
C

Cor

Hi Sean,

Thanks for your answer,

But different dateformats is not only a Net item.
There is almost always a data difference between a value stored on a disk
than in memory.

Only comparible types makes it posible to compare and therefore I was
thinking you was doing that by first converting the value's to date's (while
strings is even better and even more better strings which are trimmed on
both sides).

I was thinking on your question, did not understand why it went wrong, but
never thought about the idea that you where talking about data in different
data types.

And therefore I was not happy with your answer in the style if it was the
fault of others.

But no hard feeling, with this answer from you I will not ignore you nex
time when you have a question and help you if I can.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top