• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

Help me: dbExpress AND generator

Hi,

With IBX components i can found the property GENERATORFIELD, and i can set my generator in that property.

And in dbExpress? How can I implement a generator?

Best regards.
0
joelsilva
Asked:
joelsilva
  • 2
1 Solution
 
wneubCommented:
Hi,
what Database do you use? I use Firebird. There I search the generator value with a stored procedure, which I can execute from Delphis dbexpress component SQLStoredProcedure.
0
 
joelsilvaAuthor Commented:
Could you post your SP code, pls.?
0
 
wneubCommented:
The code of the SP in Interbase or Firebird:
CREATE PROCEDURE NAMEOFYOURSP returns (
  NAMEOFYOURPARAM Integer)
AS
BEGIN
   NAMEOFYOURPARAM = GEN_ID(NAMEOFYOURGENERATOR,1);
END

In Delphi you create a SQLStoredProcedure component and connect it with your NAMEOFYOURSP. Then:
SQLStoredProcedure.ExecProc;
MyID:=SQLStoredProcedure.ParamByName('NAMEOFYOURPARAM').AsInteger;

Thats is.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now