Autor Beitrag
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Di 30.01.07 10:21 
Hallo,
ich hab in einer mySQL-Tabelle mehrere Artikel. Jetzt möchte ich alle Artikel in einer Combobox aufgelistet haben. Wie mache ich das?

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 30.01.07 10:45 
Hi Chris!

Select distinct artikelname from Tabelle oder by artikelname;

Ich schätze du verwendest ZEOS :)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
 var i: integer;
 begin
  for i:= 0 to dbgrid1.datasource.dataset.recordcount-1 do
  begin
   deineCombobox.items.add(dbgrid1.fields[0].asstring);
   dbgrid1.datasource.dataset.moveby(1);
  end;
 end;


Dann stehen alle Artikel in der Liste.
Ob du jetzt ein DBgrid zur Visualisierung verwendest, weiß ich nicht.

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
freak4fun Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Di 30.01.07 14:28 
Danke, Stefan. Wie bekomme ich die Feldnamen dazu?

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 30.01.07 14:32 
Was meinst du mit Feldnamen?
Und wo dazu?

Mit in die Combobox?

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
freak4fun Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Di 30.01.07 14:38 
user profile iconZeitGeist87 hat folgendes geschrieben:
Was meinst du mit Feldnamen?

Die Bezeichnung des Feldes in der DB. Zum Beispiel artikel_id 1 Verstehtst du?

user profile iconZeitGeist87 hat folgendes geschrieben:
Und wo dazu?

Zu den erhaltenen Daten selbst, aber auch wenn in der Tabelle noch keine daten sind.

user profile iconZeitGeist87 hat folgendes geschrieben:
Mit in die Combobox?

Nein, davo - bzw. Vor andere Edit/Comboboxen.

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 30.01.07 14:43 
Ich hab glaub ich sowas wie

ausblenden Quelltext
1:
Query.getFieldNames					


im Hinterkopf..kann mich aber auch täuschen :)

Ich schau mal schnell nach

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Di 30.01.07 14:48 
So!

Hab nachgeschaut:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB, DBTables;

type
  TForm1 = class(TForm)
    DataSource1: TDataSource;
    Query1: TQuery;
    DBGrid1: TDBGrid;
    Button1: TButton;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  liste: TStringList;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

 query1.DatabaseName:= 'TestDB';
 query1.SQL.Text:= 'Select * from Testtabelle';
 query1.Open;

 query1.GetFieldNames(liste);
 listbox1.Items.AddStrings(liste);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
 liste:= TStringList.create;
end;

end.


Denk mal mit ZEOS dürfte das so ähnlich funktionieren.

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
freak4fun Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Di 30.01.07 15:01 
Ja, danke. :D

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen