PDA

Ver la Versión Completa : Tengo Duda de como usar ZTTable para MySQL


foxito
22-09-2008, 15:44:44
Hola lista

Tengo duda de como usar ZTTable cuando en un Formulario tengo un ZTQuery y ZTTable, el QUERY lo uso para mostrar en rejillas mi consulta y ZTTable para grabar en mi tabla, pero cuando busco en ZTQuery tambien busco en ZTTable para que ambos esten actualizados.

¿Mi pregunta es la siguiente con un solo objeto puedo hacer las 2 cosas?

Porque tengo Query y Table porque en el QUERY HAGO QUE MUESTRE EN BASE A UN CAMPO OTRA COSA. POR EJEMPLO

AQUI ESTA COMO CONSULTO

SELECT Nombre,
CASE WHEN Nivel = 1 THEN 'Grupo' ELSE 'SubGrupo'
END AS Nivel2,Id
FROM Lineas


AQUI COMO BUSCO


procedure TFrmLineas.bOkClick(Sender: TObject);
begin
begin
if EdFind.Text = '' then
begin
ShowMessage('Debe escribir un texto para realizar la búsqueda');
EdFind.SetFocus;
end
else
begin
if qLineas.Locate('NOMBRE', EdFind.Text, [loCaseInsensitive, loPartialKey]) then
begin
tLineas.Locate('NOMBRE', EdFind.Text, [loCaseInsensitive, loPartialKey]);
DBGrid.SetFocus;
end
else
ShowMessage('No se encuentra ninguna linea con esa descripción');
EdFind.Text := '';
EdFind.Enabled := False;
bOk.Enabled := False;
bNew.Enabled := True;
bEdit.Enabled := True;
bDelete.Enabled := True;
end;
end;
end;


AQUI GRABO


procedure TFrmLineas.bAceptarClick(Sender: TObject);
var
cDes : String;
begin
if GestionNuevo then
begin
tLineas.Close;
tLineas.Open;
tLineas.Insert;
//ZTLineasID.AsInteger := Id;
tLineasNombre.AsString := EdLinea.Text;
tLineasNivel.AsInteger := rdNivel.ItemIndex + 1;
tLineas.Post;
cDes := EdLinea.Text;
RefrescarLineas(cDes);
CerrarEdicion;
end
else { not GestionNuevo -> Editando existente }
begin
cDes := EdLinea.Text;
tLineas.Edit;
tLineasNOMBRE.AsString := EdLinea.Text;
tLineasNivel.AsInteger := RdNivel.ItemIndex;
tLineas.Post;
RefrescarLineas(cDes);
CerrarEdicion;
end;
end;

mightydragonlor
22-09-2008, 15:50:48
Hola foxito, este hilo ya lo creaste, no por que tengas n hilos iguales significa que te van a responder mas rápido, ademas si quieres reactivar el hilo solo tienes que comentar sobre el ya creado, es mejor que tengas cuantas la guia de estilo (http://www.clubdelphi.com/foros/guiaestilo.php), ademas creo que pronto cerrarán este hilo por incumplir con las directivas del foro.