Problema en comparacion de fechas con base de datos
Hola a todos, tengo un incoveniente con una aplicación que hice!.
La aplicacion es de estadistica para la facu, calcula datos de estadistica y genera graficos, permite guardarlos en una base de datos para que luego puedan ser comparados, ahi esta el problema, a veces compara bien y muestra los resultados, etc.. y otras veces da un error (invalid pointer operation) o se cierra solo.
Estoy hace dias viendo que puede ser y no encuentro solucion.
dejo el codigo de la unit 8 que es donde hace la comparacion a ver si me pueden dar una mano.
Código:
unit Unit8;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
TForm8 = class(TForm)
Cerrar: TButton;
ListBox1: TListBox;
ListBox2: TListBox;
Label3: TLabel;
Label1: TLabel;
Label2: TLabel;
IniciarComparacion: TButton;
GC: TStringGrid;
Chart1: TChart;
Series1: TBarSeries;
Series2: TBarSeries;
Button2: TButton;
procedure CerrarClick(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure IniciarComparacionClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form8: TForm8;
implementation
uses Unit7, Unit1, Unit5, Unit6;
{$R *.dfm}
form1.stringgrid1.Visible := False;
//
Form6.ListBox1.Items.Clear;
//
Form1.GuardarenHistoricoF91.Visible :=false;
close;
end;
procedure TForm8.ListBox1Click(Sender: TObject);
begin
form8.ListBox2.clear;
form8.ListBox2.Visible:=true;
form8.Label3.Visible:=true;
form7.ADOQuery1.Close;
form7.ADOQuery1.SQL.Text:='select fecha from valores where fecha<>f2 group by fecha order by fecha';
form7.ADOQuery1.Parameters.ParamValues['f2']:=form8.ListBox1.Items[form8.ListBox1.ItemIndex];
form7.ADOQuery1.Open;
//carga todas las fechas ingresadas
While not (form7.ADOQuery1.Eof) do
Begin
form8.ListBox2.Items.Add(form7.DFecha.Text);
form7.ADOQuery1.Next;
End;
end;
procedure TForm8.IniciarComparacionClick(Sender: TObject);
begin
if (form8.ListBox2.ItemIndex<0)or(form8.ListBox1.ItemIndex<0) then
showmessage('Primero debe seleccionar las fechas')
else
begin
Form8.Button2.Visible := Enabled;
form1.Visible:=false;
form8.GC.Cells[1,0]:=form8.ListBox1.Items[form8.ListBox1.ItemIndex];
form8.GC.Cells[2,0]:=form8.ListBox2.Items[form8.ListBox2.ItemIndex];
//para 1 fecha
form1.Ordenamiento(form8.ListBox1.Items[form8.ListBox1.ItemIndex]);
Form6.Button6Click(Sender);
form8.GC.Cells[1,1]:=form1.Edit1.Text;
form8.GC.Cells[1,2]:=form1.edit3.Text;
form8.GC.Cells[1,3]:=form1.edit4.Text;
form8.GC.Cells[1,4]:=form1.edit7.Text;
form8.GC.Cells[1,5]:=form1.Edit9.Text;
form8.GC.Cells[1,6]:=form1.Edit8.Text;
form8.GC.Cells[1,7]:=form1.Edit12.Text;
form8.GC.Cells[1,8]:=form1.Edit11.Text;
form8.GC.Cells[1,9]:=form1.Edit13.text;
//para 2 fecha
form1.Ordenamiento(form8.ListBox2.Items[form8.ListBox2.ItemIndex]);
Form6.Button6Click(Sender);
form8.GC.Cells[2,1]:=form1.Edit1.Text;
form8.GC.Cells[2,2]:=form1.edit3.Text;
form8.GC.Cells[2,3]:=form1.edit4.Text;
form8.GC.Cells[2,4]:=form1.edit7.Text;
form8.GC.Cells[2,5]:=form1.Edit9.Text;
form8.GC.Cells[2,6]:=form1.Edit8.Text;
form8.GC.Cells[2,7]:=form1.Edit12.Text;
form8.GC.Cells[2,8]:=form1.Edit11.Text;
form8.GC.Cells[2,9]:=form1.Edit13.text;
//crea grafico de comparacion
form8.Series1.Clear;
form8.Series1.Title:=form8.GC.Cells[1,0];
form8.Series1.AddXY(1,strtofloat(form8.GC.Cells[1,2]),'Mínimo');
form8.Series1.AddXY(2,strtofloat(form8.GC.Cells[1,4]),'M.Aritmética');
form8.Series1.AddXY(3,strtofloat(form8.GC.Cells[1,3]),'Máximo');
form8.Series1.AddXY(4,strtofloat(form8.GC.Cells[1,7]),'D.Medio');
form8.Series1.AddXY(5,strtofloat(form8.GC.Cells[1,8]),'D.Standard');
form8.Series2.Clear;
form8.Series2.Title:=form8.GC.Cells[2,0];
form8.Series2.AddXY(1,strtofloat(form8.GC.Cells[2,2]),'Mínimo');
form8.Series2.AddXY(2,strtofloat(form8.GC.Cells[2,4]),'M.Aritmética');
form8.Series2.AddXY(3,strtofloat(form8.GC.Cells[2,3]),'Máximo');
form8.Series2.AddXY(4,strtofloat(form8.GC.Cells[2,7]),'D.Medio');
form8.Series2.AddXY(5,strtofloat(form8.GC.Cells[2,8]),'D.Standard');
form8.Show;
end;
end;
procedure TForm8.FormCreate(Sender: TObject);
begin
form8.GC.Cells[0,0]:='Datos';
form8.GC.Cells[0,1]:='Cantidad';
form8.GC.Cells[0,2]:='Mínimo';
form8.GC.Cells[0,3]:='Máximo';
form8.GC.Cells[0,4]:='Media Aritmética';
form8.GC.Cells[0,5]:='Mediana';
form8.GC.Cells[0,6]:='Moda';
form8.GC.Cells[0,7]:='Desvío Medio';
form8.GC.Cells[0,8]:='Desvío Standard';
form8.GC.Cells[0,9]:='Varianza';
end;
end.
gracias de antemano!
|