I had that before but I took it. In fact I found where the problem is
In my Access database I have this field as "Date/Time".
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:karl REMOVE @ REMOVE openmymind REMOVEMETOO .
ANDME net:
> I think it's the - in the column names...try wrapping them in []
>
> INSERT INTO t_news ([title_pt-PT],
> [title_en-GB], [text_pt-PT], [text_en-GB], publication_date) VALUES
> (@title_pt-PT, @title_en-GB, @text_pt-PT, @text_en-GB,
> @publication_date)
>
> Karl
>
> --
> MY ASP.Net tutorials
>
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
>
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
>
>
> "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
> news:edbQXybfFHA.2424@TK2MSFTNGP09.phx.gbl...
>
> > Hello,
> >
> > I need to add a new record to an ACCESS database.
> >
> > I get the error: Syntax error in INSERT INTO statement.
> >
> > I have no idea what am I doing wrong. This is my code:
> >
> > ' Set Connection
> > Dim connectionString As String = AppSettings("connectionString")
> > Dim dbConnection As IDbConnection = New OleDbConnection(connectionString)
> >
> > ' Set Query
> > Dim queryString As String = "INSERT INTO t_news (title_pt-PT,
> > title_en-GB, text_pt-PT, text_en-GB, publication_date) VALUES
> > (@title_pt-PT, @title_en-GB, @text_pt-PT, @text_en-GB, @publication_date)"
> >
> > Dim dbCommand As IDbCommand = New OleDbCommand
> > dbCommand.CommandText = queryString
> > dbCommand.Connection = dbConnection
> >
> > ' Add Parameters
> > With dbCommand.Parameters
> > .Add(New OleDbParameter("@title_pt-PT", "sample"))
> > .Add(New OleDbParameter("@title_en-GB", "sample"))
> > .Add(New OleDbParameter("@text_pt-PT", "sample"))
> > .Add(New OleDbParameter("@text_en-GB", "sample"))
> > .Add(New OleDbParameter("@publication_date", DateTime.Now))
> > End With
> >
> > ' Insert Record
> > dbConnection.Open
> > Try
> > dbCommand.ExecuteNonQuery
> > Finally
> > dbConnection.Close
> > End Try
> >
> > Can someone tell me what is wrong?
> >
> > Thanks,
> > Miguel
> >