AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Delphi Update Database via SQL
Thema durchsuchen
Ansicht
Themen-Optionen

Update Database via SQL

Ein Thema von nanix · begonnen am 1. Dez 2009 · letzter Beitrag vom 6. Dez 2009
Antwort Antwort
Seite 2 von 3     12 3      
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#11

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:16
It's the same for SQL as without. Just leave the key field unset:
insert into <Tablename> (FirstName) values ( :firstname);
Markus Kinzler
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.541 Beiträge
 
Delphi 11 Alexandria
 
#12

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:18
I am not familiar with Absolute Database, so I cannot say if an autoinc-key can start with 0 there, but you can use this key as condition in the above example:UPDATE <tablename> SET FirstName = 'John', LastName = 'HeyHo', Sallary = 20100 WHERE EmployeeID = 1
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
nanix
(Gast)

n/a Beiträge
 
#13

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:20
You mean like this right,

Delphi-Quellcode:
ABSQuery1.SQL.Clear;
ABSQuery1.SQL.Add('UPDATE <tablename> SET FirstName = 'John', LastName = 'HeyHo', Sallary = 20100 WHERE EmployeeID = 1');
ABSQuery1.SQL.Open;
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#14

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:21
This updates Lisa with John.
Markus Kinzler
  Mit Zitat antworten Zitat
nanix
(Gast)

n/a Beiträge
 
#15

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:23
I ment the string it has to be like this,

ABSQuery1.SQL.Add('UPDATE <tablename> SET FirstName = John, LastName = HeyHo, Sallary = 20100 WHERE EmployeeID = 1'); Otherwise not compile?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.541 Beiträge
 
Delphi 11 Alexandria
 
#16

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:24
Use parameters.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
nanix
(Gast)

n/a Beiträge
 
#17

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:26
Thanks i will.

You all probably asked why does he need this.

Well to tell you the truth i need it becouse i have to load DB items to listview.Becouse there isn't a DB listview that also supports groups.
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#18

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:26
It compiles even with wrong statements. At runtime an error is then reported
Markus Kinzler
  Mit Zitat antworten Zitat
nanix
(Gast)

n/a Beiträge
 
#19

Re: Update Database via SQL

  Alt 1. Dez 2009, 14:38
Is this good idea for creating&updating items from DB to non data aware listview
  Mit Zitat antworten Zitat
nanix
(Gast)

n/a Beiträge
 
#20

Re: Update Database via SQL

  Alt 3. Dez 2009, 09:16
I ment for creating and updating DB efficiently.Anyways this is my full code.If someone can peak to it and look if something could be improved.Mainly the procedure CreateUpdateSensors

http://www.mediafire.com/?tzeiu44mmdn
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 2 von 3     12 3      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:10 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz