Autor Beitrag
Flo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: So 06.04.03 20:52 
Hi,
ich bastel gerade ein Vokabelprogramm und möchte, dass die eingegebenen Daten zufällig angezeigt werden. Ich weiß leider nicht, wie ich den Befehl im folgenden Code einbinde:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure TForm3.Button2Click(Sender: TObject);
begin
with qryAbfrage2 do begin   //franz vergleich mit tabelle (query komponente)
  Close;
  SQL.Text := 'Select Count(*) as ANZAHL From franz';
  SQL.Add('Where FRANZÖSISCH = :Französisch and DEUTSCH1 = :Deutsch1');
  ParamByName('Französisch').AsString := edit2.Text; // Parameterwerte aus Edit

  Open;
  if FieldByName('ANZAHL').AsInteger > 0 then
    ShowMessage('Richtig!')
  else
    if MessageDlg('Leider falsch. Lösungen anzeigen?',
    mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  begin
    form5.show;
  end;;

  Close
 end;
end;


Ich hoffe, dass ihr mir helfen könnt.
delphiDeveloper
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Mo 07.04.03 16:39 
Titel: Dein Interval ist [0 .. Query.RecordCount]
Ich wuerde einfach in diesem Intervall ein Random ausfuehren
und dann in einer while schleife
x-mal next ausführen
pseudemaessig als so:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
x := randomwert aus Intervall
i := 0
while not query.eof and i < x do
begin
  inc(i)
  next;
end;


Moderiert von user profile iconKlabautermann: Code-Tags hizugefügt.
Flo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mo 07.04.03 18:32 
Vielen Dank für deine Antwort, aber
wie binde ich das nun in den code ein ???
delphiDeveloper
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Mo 07.04.03 21:11 
Titel: Codeeinbindung
Das wirst du doch selber schaffen.
Ich weiß ja aus der Ferne nicht was du vor hast.

Wahrscheinlich willt du einfach per Zufall eine Vokabel ziehen
und sie dann zur Uebersetzung anzeigen.
Flo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Di 08.04.03 17:03 
Titel: Re: Codeeinbindung
delphiDeveloper hat folgendes geschrieben:
Das wirst du doch selber schaffen.
Ich weiß ja aus der Ferne nicht was du vor hast.


Nee, leider nicht :oops:

delphiDeveloper hat folgendes geschrieben:
Wahrscheinlich willt du einfach per Zufall eine Vokabel ziehen
und sie dann zur Uebersetzung anzeigen.


Ja, aber wie bekomme ich den Code in den oben genannten rein ??? :(