Question date/time not compatible with now()??

bbxrider

Registered User.
Local time
Today, 15:42
Joined
May 19, 2009
Messages
30
using a stored query to insert and getting data type mismatch when using vb.net now() to populate an access date/time field?

the error message, 5 - Data type mismatch in criteria expression.

the query, INSERT INTO behaveapps ( applicationDate, firstName, lastName )
SELECT ? AS Expr1, ? AS Expr2, ? AS Expr3;

the asp code,
Using command As New system.Data.OleDb.OleDbCommand("apptestinsert", db)
'Set the commandtype
command.CommandType = Data.CommandType.StoredProcedure
'Specify the parameters
command.Parameters.AddWithValue("applicationDate", Now())
command.Parameters.AddWithValue("firstname", firstName.Text)
command.Parameters.AddWithValue("lastname", lastName.Text)
 
still trying but no luck, i chkd the date field in access and set it to 'general date' which indicates it has both a date and time. that didn't work with now() directly or the vb.net new date time variable type,
dim dateVar as datetime
datevar = now()
now() displays out as 9/22/2009 2:26:07 PM which looks just like the way general date is shown in access.
this is access 2003, i have used now() to populate a date/time field set to general date in access 2000
 
i have used now() to populate a date/time field set to general date in access 2000
Which part of Access did you do this.

It needs to be done at the TABLE level.
 
There is always CDate(Now()) if you are getting a bad value. There is also the question of whether vb.net's Now() function is returning a string, a date/time, or a variant. You might consider returning the value to a Variant as an intermediate, then formatting it via CDate() function from VBA.
 

Users who are viewing this thread

Back
Top Bottom