Hola a todos tengo un problema que no puedo guardar los datos que agrego en mi programa hasta que se cierre el programa, osea lo añado al grid verifico con el ibexpert y aun estos datos no estan en la base de datos. cierro el programa y verifico con el ibexpert y los datos recien se guardan.
este es el codigo que uso y espero puedan ayudarme
muchisimas gracias
Código Delphi
[-]
if (sModo = 'Insertar') then
begin
with dmDatos.Categorias do
begin
Close;
SQL.Clear;
SQL.Add('INSERT INTO categoria (name_categ, fecha_categ, tipo, cuenta)');
SQL.Add('VALUES(:name_categ,:fecha_categ,:tipo,:cuenta)');
params.ParamByName('name_categ').Value := txtnombrecateg.Text;
params.ParamByName('fecha_categ').Value := FormatDateTime('dd/mm/yyyy', Date);
params.ParamByName('tipo').Value := sTipo;
params.ParamByName('cuenta').Value := txtcodigo.Text;
ExecSQL;
Close;
end;
dmDatos.Tcategorias.Active := false;
with dmDatos.categorias do
begin
Close;
SQL.Clear;
SQL.Add('SELECT * FROM categoria');
open;
end;
with dmDatos.Tcategorias do
begin
Active := true;
end;
end
else
begin
with dmDatos.Categorias do
begin
Close;
SQL.Clear;
SQL.Add('UPDATE categoria SET name_categ = ''' + txtnombrecateg.Text + ''',');
SQL.Add('cuenta = ''' + txtcodigo.Text + ''',');
SQL.Add('fecha_categ = ''' + FormatDateTime('mm/dd/yyyy', Date) + '''');
SQL.Add('WHERE clave = ' + IntToStr(iClave));
ExecSQL;
Close;
end;
end;