Exemple #1
0
 public void insertTask(Tarea user)
 {
     cmd = new SqlCommand();
     cmd.Connection = cnn;
     cmd.CommandText = "INSERT INTO Tarea (nombre,descripcion,usuario_id) VALUES ('" + user.nombre + "','" + user.description + "','" + user.usuario_id + "');";
     adapter = new SqlDataAdapter(cmd);
     cmd.ExecuteNonQuery();
 }
Exemple #2
0
        public void insertUser(Usuario user)
        {
            cmd = new SqlCommand();
            cmd.Connection = cnn;
            cmd.CommandText = "INSERT INTO usuario (nombre,direccion,telefono) VALUES ('" + user.nombre + "','" + user.direccion + "','" + user.telefono + "');";
            adapter = new SqlDataAdapter(cmd);
            cmd.ExecuteNonQuery();

            cmd.CommandText = "select TOP 1 usuario_id from usuario order by usuario_id desc";
            adapter = new SqlDataAdapter(cmd);
            cmd.ExecuteNonQuery();
            adapter.Fill(ds);

            Tarea tarea = new Tarea() { nombre = "TaskBase", description = "", usuario_id = ds.Tables[0].Rows[0][0].ToString() };
            insertTask(tarea);
        }
Exemple #3
0
        public void insert(Tarea user)
        {
            try
            {
                db = new AccessData();
                db.openConection();
                db.insertTask(user);
            }
            catch (Exception a)
            {

            }
            finally
            {
                db.closeConection();
            }
        }