Autor Beitrag
Primusio
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: So 21.08.05 18:34 
Hallo Community,
brauche mal wieder eure Hilfe.

Ich verwende die FireBird Datenbank 1.5 (SuperServer).

Ich habe ein Programm bei dem der User am Anfang sich einloggen muss hier schon die vereinfachten Quellcodezeilen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
MainWindow.pFIBDataSet1.Close;
MainWindow.pFIBDataSet1.SelectSQL.Clear;
MainWindow.pFIBDataSet1.SelectSQL.Add('SELECT * FROM SHOP_USER WHERE USERNAME = "'+ txt_username.Text +'" '); 
MainWindow.pFIBDataSet1.Open;


Zitat:

Column does not belong to referenced table.Dynamic SQL Error.
SQL error code = -206.
Column unknown.
WERT_VON_txt_username.text.
At line 1, column 31.
'.


Dieser Fehler tritt erst auf, seit ich den SQLDialect auf 3 gesetzt habe, damit die FIBplus Komponenten auch mit BigInt Feldern aus der Firebird Datenbank umgehen können.

Bin für jeden Tipp und Lösungsvorschlag dankbar, Groß- und Kleinschreibung wurde bereits beachtet, da die Datenbank mit IBExpert angelegt wurde, ist alles großgeschrieben.

MfG
Primusio
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 21.08.05 19:34 
Hier stimmt was nicht :

ausblenden Quelltext
1:
WERT_VON_txt_username.text					


Wo steht das so im Klartext drin ? :shock: Entweder ist die Fehlermeldung falsch zitiert, oder aber der Source.

_________________
Gruß
Hansa
Primusio Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: So 21.08.05 20:03 
Sorry damit meine ich, dass dort das steht was ich in das Edit-Feld txt_username eingebe.
z.B. Primusio
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 21.08.05 20:09 
Was sollen die "" ? Mache die mal weg. 8) So was testet man auch besser zuerst mit IBExpert !

_________________
Gruß
Hansa
Primusio Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: So 21.08.05 20:20 
Die doppelten Anführungszeichen sind doch notwendig, da es sich um einen Char Field handelt oder ?
Ich habe 2 Benutzer angelegt "111" und "Primusio" wenn ich im Loginfeld "111" eingebe geht es, gebe ich aber "Primusio" ein, kommt der selbe Fehler wieder.

Ich verstehe das absolut nicht.
Amiga-Fan
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 534



BeitragVerfasst: So 21.08.05 20:26 
benutz die funktion quotedstr()

_________________
- Leg dich nie mit einem Berufsprogrammierer an
- Wahre Profis akzeptieren keine einfachen Lösungen
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 21.08.05 20:41 
Zitat:
Die doppelten Anführungszeichen sind doch notwendig, da es sich um einen Char Field handelt oder ?


Probiert, oder doch nicht ? 8)

Ich benutze genau dieselbe Konstellation : FB 1.5, IBE, FIBplus und brauche keinerlei "" !

_________________
Gruß
Hansa
Primusio Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: So 21.08.05 20:54 
QuotedStr, ja so kann man das natürlich auch machen.
:autsch: :autsch: :autsch: :autsch:

Danke Leute, wie immer ist auf euch verlass.

MfG
Primusio
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: So 21.08.05 21:57 
Ähhm, Primusio. 8) Kurzfristige Erfolge sind vielleicht recht gut, aber das ist auch meist nicht von Dauer. Betrachte ich jetzt jedes lauffähige meiner Programme mit FB und FIBplus als "Projekt", dann geht das in die Hunderte !! In keinem einzigen wird QuotedStr verwendet !! Ich würde den Hinweis nicht leichtfertig ignorieren !

_________________
Gruß
Hansa
alex517
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 60


D7Ent, FB, FIBPlus
BeitragVerfasst: Mo 22.08.05 09:00 
Hi,

in Dialect 3 müssen Feld und Tabellennamen in Doppelte Anführungsstriche gesetzt werden
wenn man nicht die Großschreibung verwendet.
Zeichenfolgen werden dagegen in einfache Anführungsstriche gesetzt.

D.h. Firebird erwartet in diesem Fall einen Feldbezeichner:
ausblenden Delphi-Quelltext
1:
MainWindow.pFIBDataSet1.SelectSQL.Add('SELECT * FROM SHOP_USER WHERE USERNAME = "'+ txt_username.Text +'" ');					

was aber nicht der Fall ist.

Du mußt also
QuoteStr
oder
ausblenden Delphi-Quelltext
1:
MainWindow.pFIBDataSet1.SelectSQL.Add('SELECT * FROM SHOP_USER WHERE USERNAME = '''+ txt_username.Text +''' ');					

oder
ausblenden Delphi-Quelltext
1:
2:
MainWindow.pFIBDataSet1.SelectSQL.Add('SELECT * FROM SHOP_USER WHERE USERNAME = :USERNAME');
MainWindow.pFIBDataSet1.ParamByName('USERNAME').AsString := txt_username.Text;

verwenden.

Die nächste Falle ist übrigens ein (') in txt_username.Text..

alex
vsti
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 43

XP Home
D2005
BeitragVerfasst: Mo 22.08.05 09:22 
Nur so zur Vollständigkeit.
Bei meinem Interbase Server (auch SQL Dialect 3) übertrage ich das Hochkomma folgendermaßen:

ausblenden Quelltext
1:
MainWindow.pFIBDataSet1.SelectSQL.Add('SELECT * FROM SHOP_USER WHERE USERNAME = '+#39+ txt_username.Text +#39);					


greez

_________________
[size=10:8b472be373]Wer anderen eine Grube gräbt hat Gold im Mund.[/size:8b472be373]
Amiga-Fan
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 534



BeitragVerfasst: Mo 22.08.05 09:43 
ja aber so bekommst du ein Problem, wenn txt_username.Text ein Hochkomma enthält. Benutze besser Quotedstr.

Zitat:
Kurzfristige Erfolge sind vielleicht recht gut, aber das ist auch meist nicht von Dauer.


ich habe mit quotedstr bisher keine Probleme gehabt :wink: Nebenbei ist diese Funktion wohl nicht grundlos eingeführt worden...

_________________
- Leg dich nie mit einem Berufsprogrammierer an
- Wahre Profis akzeptieren keine einfachen Lösungen