Ver Mensaje Individual
  #2  
Antiguo 25-08-2008
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 25
Caral Va por buen camino
Hola
Primera observación, usa las etiquetas:
Despues de analizarlo con las etiquetas, lo veremos.

Código SQL [-]
SELECT Cod_Equipos, Equipos, Nombre_Cliente, Descripcion, Marca, Modelo, Serial, Fecha_Inicio, Dat_averia, Status, Fecha_Final
FROM "Equipos.db" Equipos
WHERE (Fecha_Inicio>= :fecha1) and (Fecha_Inicio <= :fecha2)

Código Delphi [-]
unit FConsuFechaEquip;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, Mask, Grids, DBGrids, ExtCtrls, Buttons;
type
TFConsuEquiFech = class(TForm)
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Label2: TLabel;
Label3: TLabel;
Label5: TLabel;
Bevel1: TBevel;
Label1: TLabel;
Label4: TLabel;
Label6: TLabel;
DBGrid1: TDBGrid;
Desde: TMaskEdit;
Hasta: TMaskEdit;
DBMemo1: TDBMemo;
DBComboBox1: TDBComboBox;
DBComboBox2: TDBComboBox;
procedure SpeedButton4Click(Sender: TObject);
procedure DesdeExit(Sender: TObject);
procedure HastaExit(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FConsuEquiFech: TFConsuEquiFech;
implementation
uses login;
{$R *.dfm}
procedure TFConsuEquiFech.SpeedButton4Click(Sender: TObject);
begin
Close ();
end;

procedure TFConsuEquiFech.DesdeExit(Sender: TObject);
Var
A,B: TDate;
begin
A:= Strtodate(Desde.text);
B:= Strtodate(Hasta.text);
if A > B then
Begin
Showmessage('La Fecha inicial no Puede ser Mayor que la Final');
desde.clear;
Activecontrol:= desde;
End;
end;
procedure TFConsuEquiFech.HastaExit(Sender: TObject);
Var
A,B: TDate;
begin
A:= Strtodate(Desde.text);
B:= Strtodate(Hasta.text);
if B < A then
Begin
Showmessage('La Fecha Final no Puede ser Menor que la Inicial');
Hasta.clear;
Activecontrol:= Hasta;
End;
end;
procedure TFConsuEquiFech.FormShow(Sender: TObject);
begin
desde.Clear;
hasta.Text := datetostr(now);
Desde.Text := datetostr(now);
end;


procedure TFConsuEquiFech.SpeedButton1Click(Sender: TObject);
begin
With ConexionDB do begin
QEquiposporFech.active :=false;
QEquiposporFech.ParamByName('fecha1').AsDate:=StrToDate(desde.text);
QEquiposporFech.ParamByName('fecha2').AsDate:=StrToDate(hasta.text);
QEquiposporFech.active :=true;
// QEquiposporFech.Dataset := QEquiposporFech;
QEquiposporFech := Desde;
QEquiposporFech := Hasta;
end;
end.
Ahora si se ve mejor.
Saludos
__________________
Siempre Novato
Responder Con Cita