I have to insert a record at run time where one of the parameters is 0;
using (SQLiteConnection conexion = new SQLiteConnection(conectionString))
{
//Inserta Investigacion1
SQLiteCommand investigacion1 = new SQLiteCommand();
investigacion1.CommandText = @"INSERT INTO Investigacion_Partida (idPartida, idInvestigacion, nivel) VALUES (@idPartida,@idInvestigacion,@nivel)";
investigacion1.Connection = conexion;
investigacion1.Parameters.Add(new SQLiteParameter("@idPartida", idPartida));
investigacion1.Parameters.Add(new SQLiteParameter("@idInvestigacion", 1));
investigacion1.Parameters.Add(new SQLiteParameter("@nivel", 0));
conexion.Open();
investigacion1.ExecuteNonQuery();
conexion.Close();
}
The problem is that this 0 detects it as a null and it's funny because if I put the same instruction in Query if you enter the 0 and insert it perfectly. (If I change the 0 for a one for example, it also inserts it well )
insert into Investigacion_Partida values(1,1,0);
This does work and I think it's exactly the same thing I want to say in c #.