Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Bases de datos > Tablas planas
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 29-06-2014
maxi915 maxi915 is offline
Miembro
NULL
 
Registrado: jul 2011
Posts: 63
Poder: 13
maxi915 Va por buen camino
bien, aca les dejo lo que intento hacer..

procedimiento cargar el turno, pero antes de cargar quiero obtener el ultimo turno cargado (siempre va a haber 1 como minimo) para luego insertar en otra tabla TurnoCliente, inserto el id_turno y id_cliente

Código Delphi [-]
procedure TFormTurnos.btnCargarTurnoClick(Sender: TObject);
var
  queryturnos:TADOQuery;
  queryProfesor:TADOQuery;
  queryTurnoCliente:TADOQuery;
  id_turno:Integer;
  hora:string;
begin
 queryturnos:=FormMenuPrincipal.queryTurnos;
 queryProfesor:=FormMenuPrincipal.queryprofesores;
 queryTurnoCliente:=FormMenuPrincipal.queryTurnocliente;
 //capturar_IdProfesor(queryProfesor,comboboxProfesores.Text,Id);

  If(edtTurnohorario.Text<>'')and(edtTurnoDisponibilidad.Text<>'')
  then
    begin
    Cargar_turno(QueryTurnos,edtTurnohorario.Text,StrToInt(edtTurnoDisponibilidad.Text),comboboxDia.Text  ,comboboxProfesores.text);
   //hasta aca funciona correctamente
    
    // aca necesito capturar el id_turno cargado para insertar en tabla clienteturno

    //capturar_idTurno(queryturnos,hora,id_turno);

 // luego inserto en la tabla TurnoCliente el id_turno (es el ultimo turno obtenido)

    Cargar_TurnoCliente(queryTurnoCliente,id_turno);

    MessageDlg('¡Se ha cargado con exito el nuevo turno!',mtConfirmation,[mbOK],0);
    end
  else
  begin
    MessageDlg('¡Hay campos incompletos!',mtConfirmation,[mbOK],0);
  end;
  edtTurnohorario.Clear;
  edtTurnoDisponibilidad.Clear;
  edtTurnohorario.SetFocus;
end;



procedimiento capturar id_UltimoTurno
Código Delphi [-]
Procedure capturar_IdTurno (Queryturnos:TADOQuery;hora:string; var id:integer);
begin
  with Queryturnos do
   begin
     SQL.Clear;
     SQL.Add('select max(idturno) from turnos);
     Open;
     id:=FieldByName('Id_turno').AsInteger;
   end;
end;


gracias!!!!
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Obtener el ultimo registro toni.vi SQL 2 09-12-2009 13:02:58
El ultimo valor ingresado pablonill SQL 5 13-12-2007 13:20:28
como obtener el ultimo registro gustavoh .NET 2 17-07-2006 14:29:07
Obtener el último registro insertado mutant09 SQL 3 04-05-2004 20:59:21
Obtener el último registro juanchi Conexión con bases de datos 2 06-02-2004 01:52:21


La franja horaria es GMT +2. Ahora son las 19:26:45.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi