Autor Beitrag
Hendrik
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: So 18.01.04 16:01 
Hi!


Wenn ich eine Query über ORDER BY sortiere, lässt sie sich nicht mehr bearbeiten. Gibt es da eine Möglichkeit, dass die Bearbeitung trotzdem möglich ist?
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: So 18.01.04 16:18 
Hallo,

welche DB?
und wie sieht dein statement aus?

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
Hendrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: So 18.01.04 21:41 
Hi!


Also eine Paradox 7.

MYSQL ist : SELECT * FROM Fahrzeuge ORDER BY Rufname

So wenn ich dann query1.edit aufrufe kommt die Meldung, dass eine Datenmenge, die zum Lesen ist nicht bearbeitet werden kann... Readonly gibt es aber nicht...
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: Mo 19.01.04 10:21 
Lies mal in der Delphi Hilfe was zu TQuery.RequestLive :wink:. Eventuell bringt Dich ja das weiter..
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mo 19.01.04 13:27 
Alternativ: Leg nen Index auf die Spalte, über die das ORDER BY läuft.

_________________
Ha! Es compiliert! Wir können ausliefern!
Nikola
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Win 3.11, Win 98, Win 2000, Win XP
D 1.0 C/S, D6 Prof. 2005 Prof.
BeitragVerfasst: Mo 19.01.04 18:09 
Hallo,

Zitat:

So wenn ich dann query1.edit aufrufe kommt die Meldung, dass eine Datenmenge, die zum Lesen ist nicht bearbeitet werden kann... Readonly gibt es aber nicht...


query1.edit :?: das geht aber nicht ehr mit table1.edit :!: und dann table1.post

und bein query:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
    with query1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('UPDATE tabellenname');
      SQL.Add('SET name='+QuotedStr(namet)+', ');
      SQL.Add('FertigungGZeit='+QuotedStr(vorname));
      SQL.Add('WHERE ID='+QuotedStr(IntToStr(datensatz)));
      ExecSQL;
    end;


mfg.
Nikola

Moderiert von user profile iconPeter Lustig: Code- durch Delphi-Tags ersetzt
Hendrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: Mo 19.01.04 18:52 
Hmm komisch, wenn die Tabelle nicht sortiert ist geht´s...
Hendrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: Mo 19.01.04 20:46 
neojones hat folgendes geschrieben:
Alternativ: Leg nen Index auf die Spalte, über die das ORDER BY läuft.


Wie kann ich n das mit dem Index während der Laufzeit machen?
Nikola
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 55

Win 3.11, Win 98, Win 2000, Win XP
D 1.0 C/S, D6 Prof. 2005 Prof.
BeitragVerfasst: Di 20.01.04 07:27 
Hallo,

dann wie oben schon beschrieben von @tomtom62
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
Query1.Open;
Query1.RequestLive:=TRUE;
Query1.SQL.Clear;
...
Query1.SQL.add('ORDER BY blabla');


mfg.
Nikola

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
Hendrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: So 25.01.04 13:51 
@ Nikola

Wenn ich die Query so sortiere, kann ich die Daten nur lesen...

Kann es sein, dass ich noch irgendetwas falsch mache?
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 25.01.04 14:24 
Einen Index kannst Du mit CREATE INDEX erstellen. Du kannst ihn jederzeit erstellen, er wird normalerweise automatisch gepflegt.

Dann benötigt Du natürlich nicht mehr das ORDER BY, wenn es für diese Spalte einen sortierten Index gibt..
Hendrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324



BeitragVerfasst: Mo 26.01.04 21:10 
Hm. Das hab ich immer noch nicht ganz gecheckt, wie das geht?!?

Wenn ich den einmal erstellt habe, brauche ich ihn nicht mehr erstellen oder wie?

Und wie ich ihn erstelle, hab ich auch noch nicht ganz verstanden...


Sorry, dass ich hier irgendwie n bissi lahm bín..
MAlsleben
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 303

W2k,WinXP
D3 - DXE3 Enterprise
BeitragVerfasst: Di 27.01.04 10:42 
Hi,

wenn Du die Daten über eine Query abrufst, ist es erstmal nur zum lesen gedacht. Um die Daten zu bearbeiten, mußt entweder Du die Query mit einer UpdateSQl Komponente verbinden oder du nimmst eine Table Komponente statt Query und aktivierst einen Index für die Sortierung. Näheres dazu steht in der Delphi Hilfe.

Gruß Micha.

_________________
Viele Wege führen nach Rom.