Problem with Insert clause in ASP.NET with Access Database

2

Sorry if this isn't the place to post this, but I don't know anywhere else to find help. The insert command won't work, might be something dumb but I can't find what's causing the problem, it says that it's a syntax error.

The code:

conn.Open();
            OleDbCommand cmd = new OleDbCommand("Insert into Partes(User, Título, Fecha, Link, CODEMP, CODFOR, NROFOR) " +
                "Values (@user, @titulo, @fecha, @link, @codemp, @codfor, @nrofor)", conn);
            cmd.Parameters.AddWithValue("user", Convert.ToString(Session["User"]));
            cmd.Parameters.AddWithValue("titulo", title.Text);
            cmd.Parameters.AddWithValue("fecha", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
            cmd.Parameters.AddWithValue("link", link.Text);
            cmd.Parameters.AddWithValue("codemp", codemp.Text);
            cmd.Parameters.AddWithValue("codfor", codfor.Text);
            cmd.Parameters.AddWithValue("nrofor", nrofor.Text);
            cmd.ExecuteNonQuery();
  System.Data.OleDb.OleDbException
  HResult=0x80040E14
  Mensaje = Error de sintaxis en la instrucción INSERT INTO.
  Origen = <No se puede evaluar el origen de la excepción>
  Seguimiento de la pila:
<No se puede evaluar el seguimiento de la pila de excepciones>

"Syntax error in the INSER INTO instruction." "The exception stack trace can't be evaluated."

c#
sql
asp.net
visual-studio
ms-access
asked on Stack Overflow Jul 22, 2019 by Sebastian Braga • edited Jul 22, 2019 by mason

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0