Autor Beitrag
phoeni-x
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win XP pro, Vista, OpenSuSE 10.3 / 11.0, MAC OS X 10.5
Delphi 5 pro, Delphi 6 ent. Lazarus 0.9.26
BeitragVerfasst: Mo 13.06.05 08:47 
Hallo,

ich habe folgendes Problem.
Ich muss aus einer Datenbank (Oracle) ein Datenbankfeld auslesen (20-stellige Zahl)
Der Datentyp lautet : NUMBER (20)

Wenn ich den enthaltenen Wert auslese und in einer Integer-Variable speichern will, dann knallt's.

Wie kann ich den Wert auslesen, damit er geändert und wieder gespeichert werden kann ?


Ich danke euch für eure schnelle Hilfe.

Torsten
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Mo 13.06.05 10:23 
Hallo!

Vielleicht hilft ja der dieser Code weiter -> www.swissdelphicente.../showcode.php?id=711

Bye!
phoeni-x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win XP pro, Vista, OpenSuSE 10.3 / 11.0, MAC OS X 10.5
Delphi 5 pro, Delphi 6 ent. Lazarus 0.9.26
BeitragVerfasst: Mo 13.06.05 15:33 
leider nein.
Ich bekomme sofort einen Fehler, sobald ich den Wert aus der DB auslesen möchte.
(ich krieg sie also nicht mal in den Speicher)

Fehler: Ungültige Variant-Typumwandlung.

Ausgelesen wird der Wert folgendermaßen:

x := ADOQuery1.FieldbyName('feldbezeichnung').Value;
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mo 13.06.05 15:55 
Interessant wäre es, welchen Typ x hat.
Wenn das nämlich Integer ist, ist der DB-Wert einfach zu groß.
Versuch es doch mal mit Double.
phoeni-x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win XP pro, Vista, OpenSuSE 10.3 / 11.0, MAC OS X 10.5
Delphi 5 pro, Delphi 6 ent. Lazarus 0.9.26
BeitragVerfasst: Mo 13.06.05 16:29 
Ja, der Wert x beschreibt eine INTEGER-Variable.
Aber auch mit DOUBLE knallt es.

Integer-Werte kann ich einlesen, wenn Sie max.
18 stellen haben. Aber 20 geht nicht mehr.
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mo 13.06.05 19:44 
hi,

welches delphi verwendest du?
Hast du mal integer64 versucht? Ist auf jeden fall ab d7 dabei.

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Mo 13.06.05 20:20 
Probiere es mal so :

ausblenden Quelltext
1:
2:
3:
x : longint;

x := ADOQuery1.FieldbyName('feldbezeichnung').Value;
phoeni-x Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18

Win XP pro, Vista, OpenSuSE 10.3 / 11.0, MAC OS X 10.5
Delphi 5 pro, Delphi 6 ent. Lazarus 0.9.26
BeitragVerfasst: Mo 13.06.05 20:57 
mit longint klappt es leider auch nicht.

Ich hab auch schon versucht das ganze als String einzulesen: ADOQuery1.FieldByName('Feldbezeichnung').asString, hilft aber
nicht weiter.

Irgendwie scheint das die Datenbankschnittstelle vorher schon zu schnallen, das da
ein Zahlenwert ausgelesen werden soll.

Vielleicht hast du noch 'nen Tipp.

Danke dir auf jeden Fall schon mal.

Gruß Torsten