0
I am creating an application for a PDA, when I try to insert data in the database I always find this error.
There was an error Parsing the query. [ Token line number = 1,Token line offset = 100,Token in error = ) ]
public static bool InsertPedido(int id, int Vim, DateTime date, int quantidade)
{
SqlCeConnection conn = new SqlCeConnection("Data Source=" + System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + @"\\DataPedido.sdf; Password =SUPER2000PED;");
conn.Open();
try
{
SqlCeCommand comando = new SqlCeCommand(@"INSERT INTO Pedido([IDLayout], [Vim], [Data], [Quantidade])VALUES(@IDLayout,@Vim,@Data,@Quantidade))", conn);
comando.Parameters.AddWithValue("@IDLatout", SqlDbType.Int).Value = id;
comando.Parameters.AddWithValue("@Vim", SqlDbType.Int).Value = Vim;
comando.Parameters.AddWithValue("@Data", SqlDbType.DateTime).Value = date;
comando.Parameters.AddWithValue("@Quantidade", SqlDbType.Int).Value = quantidade;
int row = comando.ExecuteNonQuery();
return true;
}
catch
{
throw;
}
finally
{
conn.Close();
}
}
There are two parentheses being closed at the end of the query string.
– utluiz
This question is about a small typo. It is too specific.
– utluiz
Funny! I have just finished reviewing a similar question in the OS.com: http://stackoverflow.com/q/22096468/2556111
– ramaral