Autor Beitrag
Christoph Englmann
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Mo 09.08.04 10:49 
Hallo,

hab folgendes Query:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
  QueryTglSpeichern.SQL.Clear;
  QueryTglSpeichern.SQL.Add('delete VNETS_TGL where');
  QueryTGLSpeichern.SQL.Add('STAENDE_ID =:vStaende_id and TGL_NR =:vTGL_NR');
  QueryTGLSpeichern.Params.ParamByName('vStaende_id').AsString := vStaende_ID;
  QueryTGLSpeichern.Params.ParamByName('vTGL_NR').asstring := cboTGL_2.text;
  memo2.Lines := QueryTGLSpeichern.SQL;
  QueryTGLSpeichern.ExecSQL;


die Variable vStaende_ID hat den Wert 15,
cboTGL_2.text ist 5...

wenn ich die lines der memo2 in das SQL Worksheet eingebe haut das auch einwandfrei hin...
delphi bringt mir jedoch obige fehlermeldung....

Anmerkung:
STAENDE_ID und TGL_NR sind Number-Spalten in einer Oracle Datenbank...


danke
christoph
Softchaos67
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 103

XP Prof
Delphi 7
BeitragVerfasst: Mo 09.08.04 11:56 
probier mal
ausblenden Delphi-Quelltext
1:
QueryTGLSpeichern.Params.ParamByName('vStaende_id').<span style="color: green">AsInteger</span>					
Christoph Englmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Mo 09.08.04 12:04 
danke, aber dann kommt die fehlermeldung:
"inkompatible Typen Integer und String...
Softchaos67
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 103

XP Prof
Delphi 7
BeitragVerfasst: Mo 09.08.04 12:09 
logisch, deine Felder sind String

ausblenden Delphi-Quelltext
1:
 QueryTGLSpeichern.Params.ParamByName('vStaende_id').AsInteger  := StrToInt(vStaende_id);					

Zuvor könntest du mit "val" noch prüfen, ob der String konvertiert werden kann.
Steht in der Delphi Hilfe
Christoph Englmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Mo 09.08.04 13:24 
danke, aber daran scheints nicht zu liegen, da es so auch net geht...
(ausserdem funktionieren alle meine lesezugriffe auch, obwohl ich dort vStaende_id als string verwende...

christoph
Christoph Englmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Mo 09.08.04 13:34 
oh, gott ich habs:

der Query war keine Database zugeordnet....

anmerkung (dass man vielleicht doch noch was aus diesem beitrag lernt):
asstring oder asinteger ist mehr oder weniger egal...

christoph
Softchaos67
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 103

XP Prof
Delphi 7
BeitragVerfasst: Mo 09.08.04 13:38 
Vielleicht beim Zuweisen der Parameter. Ich mache das nicht so. Versuch aber mal ein StringFeld aus der Query einem Integer zuzuweisen. Dann ist das nämlich überhaupt nicht mehr egal.
Hab vielleicht deinen Code nicht genau angeschaut.
Das du keine DB zugewisen hast konnte man daraus aber auch nicht erkennen.