AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken Delphi mySQL - ID eines neuen Datensatzes ermitteln?
Thema durchsuchen
Ansicht
Themen-Optionen

mySQL - ID eines neuen Datensatzes ermitteln?

Ein Thema von Sharky · begonnen am 14. Feb 2004 · letzter Beitrag vom 16. Feb 2004
Antwort Antwort
Benutzerbild von r_kerber
r_kerber

Registriert seit: 11. Feb 2003
Ort: Trittau
3.538 Beiträge
 
Delphi XE Professional
 
#1

Re: mySQL - ID eines neuen Datensatzes ermitteln?

  Alt 14. Feb 2004, 12:14
Hallo Sharky,

habe dazu folgendes gefunden. Vielleicht hilft es Dir weiter.
Zitat von MySQL Manual:
19.2.6 How to Get the Value of an AUTO_INCREMENT Column in ODBC

A common problem is how to get the value of an automatically generated ID from an INSERT. With ODBC, you can do something like this (assuming that auto is an AUTO_INCREMENT field):

INSERT INTO foo (auto,text) VALUES(NULL,'text');
SELECT LAST_INSERT_ID();
Or, if you are just going to insert the ID into another table, you can do this:

INSERT INTO foo (auto,text) VALUES(NULL,'text');
INSERT INTO foo2 (id,text) VALUES(LAST_INSERT_ID(),'text');
See section 19.1.12.3 How to Get the Unique ID for the Last Inserted Row.

For the benefit of some ODBC applications (at least Delphi and Access), the following query can be used to find a newly inserted row:

SELECT * FROM tbl_name WHERE auto IS NULL;
  Mit Zitat antworten Zitat
Antwort Antwort


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 00:09 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz