Autor Beitrag
tim4vfb
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45



BeitragVerfasst: Di 05.10.04 07:31 
Hallo,

habe folgendes Problem. Ich habe eine Datenbank auf einem SQL Server. In Delphi verbinde ich mich also mit einer ADO Connection, ist aber nicht zwingend notwendig, bin da auch offen für andere Vorschläge.

In meinem Programm will ich nun über ein "Suchen" Button, bestimmt Datensätze auslesen und diese dann nicht in einem Grid, sondern in einer ListView anzeigen lassen.

Kann mir jemand mal einen Hinweis geben wie ich das realisieren kann.

Wäre super!
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 05.10.04 07:58 
Da würde ich die Tabelle mit einem sinnvollen SQL-Statement öffnen. Danach in einer Schleife jeden Datensatz nehmen und die relevanten Felddaten in das Listview eintragen.
War es das, was du wissen wolltest?
tim4vfb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45



BeitragVerfasst: Di 05.10.04 08:08 
Ja, theoretisch war es das, was mir fehlt ist die Praxis. Wie bekomme ich denn die Einträge von der Tabelle, oder meintewegen von einem Grid in die List View?
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 05.10.04 08:14 
Schau dir mal die OH zu TListView an. Dort findest du unter den Eigenschaften "Items". Das Beispiel ist imho ganz brauchbar.
Auf die Daten aus deiner Tabelle greift du wie folgt zu (Beispiel mit TQuery):
ausblenden Quelltext
1:
ListView1.Items.Add(Query1.FieldByName(<Feldname>).AsString);					

Mit SubItems geht es dann fast genauso. Das siehst du aber in der OH.
tim4vfb Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45



BeitragVerfasst: Di 05.10.04 11:45 
Alles klar, danke, funktioniert