Ya lo modifique, pero me manda el siguiente error:
Código Delphi
[-]
Project Project1.exe raised exception class EInOutError with message 'I/O error 6'
De todas maneras te muestro como quedo el codigo en el boton:
Código Delphi
[-]
procedure TForm1.BitBtnGenerarClick(Sender: TObject);
var
X: Integer;
Valor: Integer;
Evalua: string;
begin
Evalua := copy(cmbEvaluacion.Text, 0, Pos('-', cmbEvaluacion.Text) - 1);
Query1.Close;
Query1.SQL.Text := Format('select det_version from det_evaluacion ' +
'where det_eval = ''%s''', [Evalua]);
Query1.Open;
lblVersion.Caption := Query1.FieldByName('det_version').AsString;
Query1.Close;
Query1.SQL.Text := Format('select * from det_evaluacion ' +
'where det_eval = ''%s'' and det_tipo = 0 and ' +
'det_valor = 0 order by det_clave', [Evalua]);
Query1.Open;
X := 1;
while not Query1.Eof do
begin
sgEvaluacion.RowCount := X + 1; sgEvaluacion.Cells[0, X] := Query1.FieldByName('det_pregunta').AsString;
sgEvaluacion.Cells[1, X] := Query1.FieldByName('det_pregunta').AsString;
Query2.Close;
Query2.SQL.Text := Format('select * from det_evaluacion ' +
'where det_eval = ''%s'' and det_tipo = 1 and ' +
'det_clave like ''%s.%%'' and det_valor = 0 ' +
'order by det_clave', [Evalua, Query1.FieldByName('det_clave').AsString]);
Query2.Open;
while not Eof do
begin
Inc(X);
sgEvaluacion.RowCount := X + 1; sgEvaluacion.Cells[0, X] := Query2.FieldByName('det_clave').AsString;
sgEvaluacion.Cells[1, X] := Query2.FieldByName('det_pregunta').AsString;
Query3.Close;
Query3.SQL.Text := Format('select det_valor from det_evaluacion ' +
'where det_eval = ''%s'' and det_clave like ''%s.%%'' and ' +
'det_tipo = 2 order by det_valor asc', [Evalua,
Query1.FieldByName('det_clave').AsString]);
Query3.Open;
while not Query3.Eof do
begin
Valor := Query3.FieldByName('det_valor').AsInteger;
sgEvaluacion.Cells[Valor + 1, X] := IntToStr(Valor);
Query3.Next;
end;
sgEvaluacion.Cells[7, X] := 'Resultado';
Query2.Next
end;
Inc(X); Query1.next
end
end;