DataTime Problem

  • Thread starter Thread starter Jacko
  • Start date Start date
J

Jacko

Hi,

I had inserted in a Access Db in field of type DateTime the value
DateTime.Today (OleDb)

Later my client suggested they needed the Time as well in the field, so i
changed to DateTime.Now and it threw up an error.

Since both DateTime.Today and DateTime.Now are of type DateTime why do i get
a error?

TIA
Barry
 
cmd.Parameters.Add(@SendDate, DateTime.Today); // This work

cmd.Parameters.Add(@SendDate, DateTime.Now); // This show an error

cmd above is OleDbCommand

Does this answer your question??
 
I posted my previous reply thinking that you are an expert, unfortunately
you don't seem to be one.
 
It seems like, Patrice has a lot quite a few friends/admirers here.

You guys should note that when someone posts a message here he/she assumes
that the info posted is sufficent for others to understand, what the problem
is all about, i do not think anyone will post a message knowing well that
the message will not get any replies.

I had solved the problem in a round-about way, much before i posted the
message, my idea of posting this message was to get it across to those who
may be interested to know that there is a problem either in MS Access or
..NET Framework.

The code was part of a large app and going back to the app just to reproduce
the exact error message would have taken me hours of work, and that was not
worth the effort of posting this message.

The error message as far as i can recollect was something similar to "Data
type mismatch".

There are many way of asking question, some of them can by themselves be
insulting in nature.
 
Jacko said:
...

I had solved the problem in a round-about way, much before i posted the
message, my idea of posting this message was to get it across to those who
may be interested to know that there is a problem either in MS Access or
.NET Framework.

So now someone with the problem you described will not know how you solved
it. Frequently people find these posts when searching for similar problems.

The code was part of a large app and going back to the app just to
reproduce the exact error message would have taken me hours of work, and
that was not worth the effort of posting this message.

Until now you never claimed you had got the code to work. In fact, you
actually posted code you said failed.

It was apparent from your post you were asking for help, not that you were
trying to help others. Note that your first post include "Since both
DateTime.Today and DateTime.Now are of type DateTime why do i get a error?",
not "...why did I get an error?".
 
I do not find anything insufficent or incorrect in my replies so far,
irrespective of how many friend or admirers Patrice has, the only mistake i
could have made is that i did not not mention that i had solved the problem,
in my initial posting.


Peter Duniho said:
It seems like, Patrice has a lot quite a few friends/admirers here.

You write that as if it's a bad thing. Though, to be clear...I can't say
that there are any really close relationships between people following
this newsgroup. What I can say is that we expect people asking questions
to ask answerable questions, to provide additional details when requested,
and to not exhibit hostility when they are asked for those additional
details.
You guys should note that when someone posts a message here he/she
assumes
that the info posted is sufficent for others to understand, what the
problem
is all about, i do not think anyone will post a message knowing well that
the message will not get any replies.

You should note that when someone replies to a question you've posted
here, there is the implicit assumption that the person who replied is
trying to be helpful.

It's clear what assumptions you made. The problem is that even after it
was pointed out to you that your assumptions were incorrect, you failed to
correct those assumptions and elaborate on your question. Your further
hostility in the face of additional reminders of your incorrect
assumptions suggest that rather than looking to get an answer to your
question, you would prefer to be abusive.

After all, a person who wanted an actual answer would just provide the
additional information requested.
I had solved the problem in a round-about way, much before i posted the
message, my idea of posting this message was to get it across to those
who
may be interested to know that there is a problem either in MS Access or
.NET Framework.

No one reading this message thread will have any clue whatsoever what
problem you had, never mind in what component it exists or how to work
around it.
The code was part of a large app and going back to the app just to
reproduce
the exact error message would have taken me hours of work, and that was
not
worth the effort of posting this message. [...]

Then you are wasting everyone's time. Please don't do that.

If it's not worth your time to provide an answerable question, then it's
not worth anyone else's time to try to answer your question.

Pete
 
I did not know that besides programmer, this forum also has people from the
Legal faternity, those who try to find words between sentences like "do /
did".

Hence forth i may need to get my messages verified by a legal expert before
posting it here.
 
Finally, thanks.

I did use "Add" not "AddWithValue" since the project was developed in VS
2003 .NET Framework 1.1 (forgot to mention this in my original posting),
maybe there was some update in .Net Framework 2.0, which permits both to
work.

This is what i did to get around the problem

cmd.Parameters.Add("@SendDate", OleDbType.DateTime).Value = new
DateTime(year, month, day, hours, minutes, seconds); // these values are of
DateTime.Today

Note: I had solved the issue before posting the original message, it was
only meant as a message to those who matter.
 
Back
Top