RE: Date/Time Strange Problem
- From: Jouni Karppinen <JouniKarppinen@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 1 Jul 2005 00:38:03 -0700
Try something like this:
cmd.Parameters.Add("@publication_date", DbType.DateTime).Value = DateTime.Now;
"Shapper" wrote:
> Hello,
>
> I am having an error when inserting a record in an Access database.
>
> The field [publication_date] is of Date/Time type.
>
> This is my query and the parameters for that field:
>
> Dim queryString As String = "INSERT INTO [t_news] ([title], [text],
> [publication_date]) VALUES (@title, @text, @publication_date)"
>
> Dim dbCommand As IDbCommand = New OleDbCommand
> dbCommand.CommandText = queryString
> dbCommand.Connection = dbConnection
>
> With dbCommand.Parameters
> .Add(New OleDbParameter("@title", "sample"))
> .Add(New OleDbParameter("@text", "sample"))
> .Add(New OleDbParameter("@publication_date", DateTime.Now))
> End With
>
> I get the error "Data type mismatch in criteria expression."
>
> What is wrong here?
>
> Thanks,
> Miguel
>
>
>
>
.
- References:
- Date/Time Strange Problem
- From: Shapper
- Date/Time Strange Problem
- Prev by Date: Re: Design Patterns Books and Best Practices Books.
- Next by Date: Multiple threads or app instances?
- Previous by thread: Re: Date/Time Strange Problem
- Next by thread: Re: Problems Deploying Data Access Application Block
- Index(es):
Relevant Pages
|