Autor Beitrag
MKSlayer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62

SUse / WinXp / Win 2003 server
Turbo Delphi / Borland Builder 4
BeitragVerfasst: Mi 09.07.08 09:42 
Fogenden fehler bekomme ich beim Compilieren

[Fehler] Unit2.pas(152): E2056 String-Literale können maximal 255 Elemente besitzen

fehler trit an der Stelle auf wo ich den SQL String belege

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:
49:
procedure TForm2.EkImgBtn3Click(Sender: TObject);
var ueber1, ueber2, ueber3, ueber4, ueber5, datum, info, s_art1, s_art2, s_art3, s_art4, s_art5, sen_v, sen_b, SQL :String;
    s_groe1, s_groe2, s_groe3, s_groe4, s_groe5  : Integer;
begin

ueber1:=Edit1.Text;
ueber2:=Edit7.Text;
ueber3:=Edit8.Text;
ueber4:=Edit9.Text;
ueber5:=Edit10.Text;
s_art1:=Combobox1.Text;
s_art2:=Combobox2.Text;
s_art3:=Combobox3.Text;
s_art4:=Combobox4.Text;
s_art5:=Combobox5.Text;
s_groe1:=StrToInt(Edit6.Text);
s_groe2:=StrToInt(Edit3.Text);
s_groe3:=StrToInt(Edit11.Text);
s_groe4:=StrToInt(Edit12.Text);
s_groe5:=StrToInt(Edit13.Text);
sen_v:=Edit4.Text;
sen_b:=Edit5.Text;
Form1.ZQuery1.Close;
Form1.ZQuery1.SQL.Clear;
SQL:='Insert Into Powerpoint_auto (Text_1, Text_2, Text_3, Text_4, Text_5, Text_1_Schriftart, Text_2_Schriftart, Text_3_Schriftart, Text_4_Schriftart, Text_5_Schriftart, Text_1_Schriftgroese, Text_2_Schriftgroese, Text_3_Schriftgroese, Text_4_Schriftgroese, Text_5_Schriftgroese, Senden_von, Senden_bis)  Values (:Text_1, :Text_2, :Text_3, :Text_4, :Text_5, :Text_1_Schriftart, :Text_2_Schriftart, :Text_3_Schriftart, :Text_4_Schriftart, :Text_5_Schriftart, :Text_1_Schriftgroese, :Text_2_Schriftgroese, :Text_3_Schriftgroese, :Text_4_Schriftgroese, :Text_5_Schriftgroese, :Senden_von, :Senden_bis)';
Form1.ZQuery1.SQL.Add(SQL);
Form1.ZQuery1.ParamByName('Text_1').AsString := ueber1;
Form1.ZQuery1.ParamByName('Text_2').AsString := ueber2;
Form1.ZQuery1.ParamByName('Text_3').AsString := ueber3;
Form1.ZQuery1.ParamByName('Text_4').AsString := ueber4;
Form1.ZQuery1.ParamByName('Text_5').AsString := ueber5;
Form1.ZQuery1.ParamByName('Text_1_Schriftart').AsString := s_art1;
Form1.ZQuery1.ParamByName('Text_2_Schriftart').AsString := s_art2;
Form1.ZQuery1.ParamByName('Text_3_Schriftart').AsString := s_art3;
Form1.ZQuery1.ParamByName('Text_4_Schriftart').AsString := s_art4;
Form1.ZQuery1.ParamByName('Text_5_Schriftart').AsString := s_art5;
Form1.ZQuery1.ParamByName('Text_1_Schriftgroese').AsInteger := s_groe1;
Form1.ZQuery1.ParamByName('Text_2_Schriftgroese').AsInteger := s_groe2;
Form1.ZQuery1.ParamByName('Text_3_Schriftgroese').AsInteger := s_groe3;
Form1.ZQuery1.ParamByName('Text_4_Schriftgroese').AsInteger := s_groe4;
Form1.ZQuery1.ParamByName('Text_5_Schriftgroese').AsInteger := s_groe5;
Form1.ZQuery1.ParamByName('Senden_von').AsString := sen_v;
Form1.ZQuery1.ParamByName('Senden_bis').AsString := sen_b;
Form1.ZQuery1.ExecSQL;
Form1.ZQuery1.SQL.Clear;
Form1.ZQuery1.SQL.Add('Select * From powerpoint_auto');
Form1.ZQuery1.Open;

end;
baka0815
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 489
Erhaltene Danke: 14

Win 10, Win 8, Debian GNU/Linux
Delphi 10.1 Berlin, Java, C#
BeitragVerfasst: Mi 09.07.08 09:47 
Mit String-Literal ist der Wert zwischen ' und ' gemeint. Wenn du das aufsplittest in
ausblenden Delphi-Quelltext
1:
2:
SQL := 'select * ';
SQL := SQL + 'from TABLE';

dann sollte das funktionieren.
Kannst das natürlich auch in der einen Zeile machen, also
ausblenden Delphi-Quelltext
1:
SQL := 'select * ' + 'from TABLE';					
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 09.07.08 09:48 
Die Suche ist schon eine tolle Funktion....
www.delphi-forum.de/...light=stringliterale
alex517
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 60


D7Ent, FB, FIBPlus
BeitragVerfasst: Mi 09.07.08 09:52 
Hi,

überprüf mal in den Projekt-Optionen oder im Quelltext die Compiler-Schalter.
Du hast als Standard-String die ShortStrings definiert. Diese können max 255 Zeichen haben.

siehe Hilfe:
Zitat:

Huge-Strings
Strings aus der Garbage Collection sind erlaubt. Wenn diese Option aktiviert ist, entspricht das Schlüsselwort string dem Typ AnsiString. Andernfalls entspricht string dem Typ ShortString. Diese Option entspricht dem Schalter {$H}.


alex
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 09.07.08 09:56 
user profile iconalex517 hat folgendes geschrieben:
Hi,

überprüf mal in den Projekt-Optionen oder im Quelltext die Compiler-Schalter.
Du hast als Standard-String die ShortStrings definiert. Diese können max 255 Zeichen haben.

siehe Hilfe:
Zitat:

Huge-Strings
Strings aus der Garbage Collection sind erlaubt. Wenn diese Option aktiviert ist, entspricht das Schlüsselwort string dem Typ AnsiString. Andernfalls entspricht string dem Typ ShortString. Diese Option entspricht dem Schalter {$H}.


alex


Nö, der Stringtyp ist in Ordnung. Das ist ein Problem des Editors / Compilers. Kannste ja selber relativ einfach ausprobieren.
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mi 09.07.08 09:57 
Solche Probleme kann man auch mit der Verwendung von (SQL-)Parametern umgehen

_________________
Markus Kinzler.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mi 09.07.08 09:59 
Er verwendet doch schon SQL Parameter?

Das Problem ist einfach, dass er alle Spalten hintereinander schreibt, statt ab und zu mal einen Zeilenumbruch.
alex517
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 60


D7Ent, FB, FIBPlus
BeitragVerfasst: Mi 09.07.08 10:09 
@Xentar
hast Recht.
Mit $H- kommt allerdings die gleich Fehlermeldung.