Autor Beitrag
olliterski
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 105
Erhaltene Danke: 2

Win7 64-Bit
D7 Ent.
BeitragVerfasst: Di 21.01.03 13:31 
Hallo,

Ich habe auf meinem ASA8-Server folgende Procedure:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
CREATE PROCEDURE DBA."spu_aufnr_1" (out auft int)

BEGIN
   
   declare auf1 int;
  update nummernkreis set
    nk_nr = (select max(nk_nr)+1 into auf1 from nummernkreis where nk_id =1) 
    where nk_id =1;
   set auft= auf1;
END;

Die Tabelle Nummernkreis enthält die Felder NK_ID integer autoincrement und NK_NR Integer.

Der Startwert in NK_NR ist 10000. Wenn ich diese Proc ausführe (sie funzt!!!), erhalte ich einen um 1 erhöhten Wert. Rufe ich das ganze jedoch mit folgendem kleinen Programm in Delphi auf, erhalte ich die ersten Male 0 und danach irgenwelche Werte jenseits von gut und böse (Bsp.: 19065432, etc.)!!!

hier der Delphi-Code:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    StoredProc1: TStoredProc;
    DataSource1: TDataSource;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
   StoredProc1.Prepare();
   StoredProc1.ExecProc();
   Edit1.Text:= inttostr(StoredProc1.Params.Items[0].Value);
   StoredProc1.UnPrepare();
end;

end.

Ich bräuchte dringend eure Hilfe!!

Viele Grüße

Oliver

_________________
Viele Grüße
Oliver
olliterski Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 105
Erhaltene Danke: 2

Win7 64-Bit
D7 Ent.
BeitragVerfasst: So 02.02.03 12:20 
Titel: Es ist gelöst!!!
Hi,

für alle die mal in die selbe Falle laufen, hier ein Lösungsansatz:

www.swissdelphicente...d8a2a6b79642024d29dd

Viele Grüße

Oliver

_________________
Viele Grüße
Oliver