Autor Beitrag
Becks16
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Fr 17.09.04 06:31 
Hallo

Ich habe hier einen Quelltext wie ich aus einem DateTimePicker was ausgelesen habe.
ausblenden Delphi-Quelltext
1:
DateTimePicker2.DateTime := query_projektverwalten.FieldByName('ende').AsDateTime;					


Wie mache ich das jetzt mit einem DBGrid ??????


Moderiert von user profile iconChristian S.: Topic aus Sonstiges verschoben am Fr 17.09.2004 um 07:49
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: Fr 17.09.04 07:16 
genauso
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Fr 17.09.04 07:18 
hmmm aber was kommt nach dem Punkt ....da kommt bestimmt was anderes hin als DateTime oder ??
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: Fr 17.09.04 07:22 
Nein.
Das DBGrid hat damit nämlich nichts zu tun.
Du willst doch nur Informationen aus der Datenbank auslesen. Die Verbindung zu Deinen Daten erfolgt über die TQuery-Komponente. Das DBGrid ist "nur" zur Anzeige der Daten da.
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Fr 17.09.04 07:58 
Ich geb oben in mein Editfeld die Projektnummer ein dann gibt er mit mit diesen Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm_projektverwaltung.Edit_projektnummerChange(
  Sender: TObject);
//MS 14.09.2004 hdsgjkfagkf
begin
  if Edit_projektnummer.Text >'' then  //wenn es größer als leer ist dann holt er sich die aktuellen daten vom projekt
  begin
    query_projektverwalten.SQL.Text :='select * from Projekt where id ='+Edit_projektnummer.Text;
    query_projektverwalten.open;
    edit_projektname.Text := query_projektverwalten.FieldByName('projektname').AsString; //datenauslesen von query
    edit_anzahlmitarbeiter.Text := query_projektverwalten.FieldByName('anzahl').AsString;
    Memo1.Text := query_projektverwalten.FieldByName('beschreibung').AsString;
    DateTimePicker1.DateTime := query_projektverwalten.FieldByName('begin').AsDateTime;
    DateTimePicker2.DateTime := query_projektverwalten.FieldByName('ende').AsDateTime;
    //DBGrid2. := query_mitarbeiter.FieldByName('name)').AsString;
  end;
end;


Den Projektnamen, Datum, Beschreibung u.s.w. aus, nun will ich das wenn ich in dem Editfeld Projektnummer, eine Projektnummer eingebe das er mir in dem DBGrid die Mitarbeiter ausgibt die an dem Projekt mitgemacht haben
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Fr 17.09.04 08:11 
Dem DBgrid kannst nichts übergeben. Wie jasocul schon sagte kommen die Daten aus der Datenquelle bzw. der Table oder Query. Wenn Du die entsprechend änderst zeigt er Dir das auch im DBgrid an.

_________________
Ha! Es compiliert! Wir können ausliefern!
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Fr 17.09.04 08:15 
Das verstehe ich nicht, tut mir leid kann mir das jemand näher erläutern ??
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: Fr 17.09.04 08:34 
Du must Dein zweites DBGrid mit einer DataSource verbinden. Diese DataSource muss mit der Mitarbeiter-Query verbunden sein.
Das SQL-Statement von der Mitarbeiter-Query musst Du aktualisieren/neu schreiben, wenn ein anderer Mitarbeiter gewählt wurde.
ausblenden Delphi-Quelltext
1:
2:
3:
Query_projektverwalten.Close;
Query_projektverwalten.SQL.Text := 'select * from Projekt where name = ''' + edit_mitarbeiter.text + '''';
Query_projektverwalten.Open;

Das kannst Du wahrscheinlich nicht 1:1 übernehmen. Also schau genau hin, was gemacht werden muss.