Re: oledb and dates in vb.net 2003



Declare timNow as a string and run the conversion function on the
setter. You can then print the variable value to the immediate window
to see if the value you are passing to Jet in the strSQL string is
formatted correctly. Ditto strSQL. Also, you can paste the strSQL
string into an Access query window (the SQL pane) to validate the
syntax.

-Mary

On Tue, 1 May 2007 11:50:02 -0700, "Tom" <tom@xxxxxxxxxxxxxxxx> wrote:

Hi,

I have an Access 2000 database that I'm loggin data to and need to store the
date/time of the logged data in a field. I can log the individual data
elements just fine but the date is knocking me around some. It keeps giving
me the standard 'Data type mismatch in criteria expression' error. I'm
attempting to insert via

timNow = DateTime.Now
strSQL = "INSERT INTO LOG1 (LogTime) VALUES ('#" & CType(timNow, String) &
"#')"

Help please. I've already wasted 4 hours on this

Thanks

Tom

.



Relevant Pages


Loading