AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Mysql Typs (Null) Typ (Integer)

Ein Thema von question · begonnen am 25. Aug 2013 · letzter Beitrag vom 25. Aug 2013
 
Benutzerbild von sx2008
sx2008

Registriert seit: 15. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#2

AW: Mysql Typs (Null) Typ (Integer)

  Alt 25. Aug 2013, 20:43
Delphi-Quellcode:
// Fill a parameter with NULL
QueryB.ParamByName('NewID').Value := Null;

// Fill a field with NULL
QueryB['SomeField'] := Null;
// alternative way to set a field to NULL
QueryB.FieldByName('SomeField').Clear;

// testing if a field is NULL
if Query.FieldByName('SomeField').IsNull then ...



// Copy a Field that might be NULL
// the VCL converts different datatypes on the fly e.g. from Integer -> string
QueryB['DestinationField'] := QueryA['SourceField'];
// this is the same as (long version of the line above)
QueryB.FieldByName('DestinationField').Value := QueryA.FieldByName('SourceField').Value;



// and some bonus info...
// how to set the SQL string of a query in a single line without using .Clear() followed by a .Add()
Query.SQL.Text := 'SELECT * FROM TableA WHERE ID = :ID';
fork me on Github
  Mit Zitat antworten Zitat
 


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 06:50 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