By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 697 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Date comparison does not work correctly??

P: n/a
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

Jul 21 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
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.
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:dU******************@news01.bloor.is.net.cabl e.rogers.com...
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

Jul 21 '05 #2

P: n/a
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
"emg" <emg no sp**@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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.
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message news:dU******************@news01.bloor.is.net.cabl e.rogers.com...
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


Jul 21 '05 #3

P: n/a
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.
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in message
news:co*******************@twister01.bloor.is.net. cable.rogers.com...
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
"emg" <emg no sp**@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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.
"Lloyd Sheen" <sq*******************@tostopspamhotmail.com> wrote in

message
news:dU******************@news01.bloor.is.net.cabl e.rogers.com...
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



Jul 21 '05 #4

P: n/a
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

Jul 21 '05 #5

P: n/a
Lloyd Sheen wrote:
Any ideas??


Compare them as strings? <g>

-- Mark
Jul 21 '05 #6

P: n/a
That is what I ended up doing. If I check as poFile.ToString then there is
no problem.

"Mark Jerde" <ma********@verizon.no.spam.net> wrote in message
news:uf**************@TK2MSFTNGP10.phx.gbl...
Lloyd Sheen wrote:
Any ideas??


Compare them as strings? <g>

-- Mark

Jul 21 '05 #7

P: n/a
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

"Cor" <no*@non.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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

Jul 21 '05 #8

P: n/a
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
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.

Jul 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.