I have a problem with the command INSERT. I compile the application and this works but the row isn't inserted in the database (no throws any error). The database is included in the project and has the property "Copy always". I'm developing a project with WPF and C#, but for the connection and querys, i use C#.
Thanks!
public SQLiteConnection conexion;
SQLiteCommand cmd;
public MainWindow()
{
InitializeComponent();
Conectar();
}
public void Conectar ()
{
try
{
//Connection
conexion = new SQLiteConnection("Data Source=eldelbar.s3db;Version=3;New=True;Compress=True;");
conexion.Open();
//Insert query
string insercion = "insert into cerveza (nombre,precio) values('amstel', 1.3);";
cmd = new SQLiteCommand(insercion, conexion);
int cantidad = cmd.ExecuteNonQuery();
if (cantidad < 1)
MessageBox.Show("No se ha podido insertar");
cmd.Dispose();
conexion.Close();
}
catch (Exception e)
{
MessageBox.Show("Error2!" + e.Message);
}
}