Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #33  
Antiguo 16-12-2008
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 25
Caral Va por buen camino
Hola
1-A mi me muestra (Horarios/Personal) en esa celda, no se por que a ti no.
2-No me sigue dando el error.
3-Para que se actualice el stringgrid hay que actualizar la sentencia sql.
Es exacta a la que uso en el datetimepicker.
Para que la veas asi quedaria el evento Onshow del form Turnos:
Código Delphi [-]

procedure TTurnos.FormShow(Sender: TObject);
begin
with StringGrid1 do
begin
//Título de las Filas
Cells[0, 0] := 'Horario/Profesionales';
Cells[0, 1] := '09:00';
Cells[0, 2] := '09:30';
Cells[0, 3] := '10:00';
Cells[0, 4] := '10:30';
Cells[0, 5] := '11:00';
Cells[0, 6] := '11:30';
Cells[0, 7] := '12:00';
Cells[0, 8] := '12:30';
Cells[0, 9] := '13:00';
Cells[0, 10] := '13:30';
Cells[0, 11] := '14:00';
Cells[0, 12] := '14:30';
Cells[0, 13] := '15:00';
Cells[0, 14] := '15:30';
Cells[0, 15] := '16:00';
Cells[0, 16] := '16:30';
Cells[0, 17] := '17:00';
Cells[0, 18] := '17:30';
Cells[0, 19] := '18:00';
Cells[0, 20] := '18:30';
Cells[0, 21] := '19:00';
Cells[0, 22] := '19:30';


//Titulo de las Columnas
consulta:= 'Select [Apellido_emp], [Nombre_emp] from Personal';
adoquery1.Close;
adoquery1.SQL.Text := consulta;
adoquery1.Open;

i:= 2;
datasource1.DataSet.First;

while not datasource1.DataSet.Eof do
begin
stringgrid1.ColCount := i;
stringgrid1.Cells[(i - 1),0]:= datasource1.DataSet.FieldByName('Apellido_emp').AsString + ' '+ datasource1.DataSet.FieldByName('Nombre_emp').AsString;

inc(i);
datasource1.DataSet.Next;
end;


adoquery2.Close;
adoquery2.SQL.Text := 'Select Nombre, Legajo, Servicio, Pos_col, Pos_fila from Turnos Where Fecha_turno = :Fec';
adoquery2.Parameters[0].Value:= DateToStr(DateTimePicker1.Date);
adoquery2.Open;

while not datasource2.DataSet.Eof do
begin
a:= datasource2.DataSet.FieldByName('Pos_fila').AsInteger;
b:= datasource2.DataSet.FieldByName('Pos_col').AsInteger;
stringgrid1.Cells[(b),(a)]:= datasource2.DataSet.FieldByName('Nombre').AsString + '//'+ datasource2.DataSet.FieldByName('Servicio').AsString;

inc(a);
inc(b);
datasource2.DataSet.Next;

adoquery1.Close;
end;
end;
end;
Revisa el codigo y veras la diferencia.
Es bueno que te empapes del codigo.
Saludos
__________________
Siempre Novato
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
Traer datos de una tabla y ordenarlos en un dbgrid ordenados Petolansa Varios 3 07-12-2007 15:40:03
Traer datos de un dbgrid Petolansa Varios 3 19-10-2007 17:54:18
Traer datos desde otra bd con un SP Walterdf Firebird e Interbase 3 15-08-2007 18:47:30
Insertar y traer datos de una tabla en .NET Alexander .NET 0 26-08-2005 19:54:02
Traer los datos de una tabla a un dbcombo andresenlared Conexión con bases de datos 1 29-12-2003 17:18:04


La franja horaria es GMT +2. Ahora son las 08:30:19.


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