Autor Beitrag
majolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Mi 01.01.03 15:31 
Hallo,

ich wollte mal SQL ausprobieren und habe versucht Daten in eine Datenbank hinzuzufügen.Problem ist,dass ich das in der Verbindung mit Delphi nicht gebacken kriege.
Ich weiß,dass man mit
ausblenden Quelltext
1:
INSERT INTO DATENBANK (SPALTE) VALUES (WERT)					

Jedoch ändern sich die Spalte und der Wert.Der Wert soll ein Wert aus einem Editfeld sein.
Ich habe versucht den Sql-Code zur Laufzeit ins SQL Objekt des Querys zuschreiben.Das klappt auch.Jedoch bekomme ich den Code nicht aus geführt.Kann mir vielleicht einer mal einen Beispiel-Code posten.Das tutorial von auq.de habe ich durchgearbeitet, aber das ist ja nur eine simple abfrage.
Danke im vorraus
Gruß
majolo
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Mi 01.01.03 16:04 
Hi und ein frohes Neues,

hier mal ein Beispiel für Dich :

ausblenden Quelltext
1:
2:
3:
Query1.SQL.Clear;
Query1.SQL.Add('INSERT INTO datenbank (spalte1) VALUES ('+QuotedStr(edit1.text)+')');
Query1.ExecSQL;


Bei SQL-Abfragen (SELECT, DROP) schreibst du folgenden Befehl :

ausblenden Quelltext
1:
Query1.Open;					


Bei SQL-Befehlen wie INSERT, UPDATE, ALTER schreibst Du folgenden Befehl :

ausblenden Quelltext
1:
Query1.ExecSQL;					


Ich hoffe ich konnte Dir damit weiterhelfen.
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Mi 01.01.03 16:13 
Also genauso habe ich bei einem Versuch den Code auch aufgebaut.Trotzdem vielen Dank. Könnte es sein,dass der Name der Spalte nicht mit einer Zahl beginnen darf.Meine Spalte heißt zum Beispiel so:
1PS_SG_Praes_Ind_Akt
Vielleicht ist das nicht erlaubt??

Gruß
majolo
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Mi 01.01.03 16:21 
Meines wissens darf eine Spalte nicht mit einer Zahl anfangen. Ich weiß es aber nicht genau, weil ich noch nie einem Spaltennamen als erste Zeichen eine Zahl gegeben habe. Es kommt vielleicht auch auf die Datenbank an, welche benutzt Du denn ?
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Mi 01.01.03 19:54 
Also ich benutze Paradox 7.Aber wenn das stimmt,dass der Anfang einer Spalte nicht mit einer Zahl beginnen darf, ist das wahrscheinlich ein Standard. Wenn der Wert nämlich keine Zahl ist dann macht er das einwandfrei.Dann war wahrscheinlich das das Problem.Aber wäre vielleicht interessant,wie das genau ist mit Zahlen am Spaltenanfang.
Gruss

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



BeitragVerfasst: Mi 01.01.03 20:12 
Hi,

Zitat:
Aber wäre vielleicht interessant,wie das genau ist mit Zahlen am Spaltenanfang.


Wenn Du es doch probiert hast, dann ist es ja gut. Hast Du schon mal versucht eine Variable mit einer Zahl am Anfang zu deklarieren ? Probiers mal ! :mrgreen:

Gruß
Hansa
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Do 02.01.03 21:45 
Zitat:
Hast Du schon mal versucht eine Variable mit einer Zahl am Anfang zu deklarieren ?


Eigentlich nicht.Deinem Grinsen zu urteilen klappt es nicht.Folglich spare ich mir den Versuch :mrgreen:

Gruss
majolo
hansa
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3079
Erhaltene Danke: 9



BeitragVerfasst: Do 02.01.03 21:54 
Hi,

Feigling :P

Gruß
Hansa

P.S.: Halunke, natürlich hast Dus probiert ! :lol:
majolo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 334

Ubuntu 8.04, WinXP Prof.
D1, D6Pers, D7 Prof., D8 Prof., D2005 Pers
BeitragVerfasst: Sa 04.01.03 13:49 
Nein, wirklich nicht.

Gruß

Der Feigling :(