Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: FDSstoredProc with GUID Parameters

Permlink Replies: 0
Milan Vydareny

Posts: 17
Registered: 11/6/11
FDSstoredProc with GUID Parameters
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 1, 2017 7:52 AM
Using RAD Studio Delphi 10.1 Berlin Update 2, Interbase 2017.

FDConnection component specifies ExtendedMetadata = True;

Stored procedure that has several input parameters that are GUIDs. They
are defined as


TFDStoredProcedure.Params identifies these as datatype ftBytes.

Setting the parameters in code is:

FDStoredProcedure1.Params[0].AsGUID = LGUID;
FDStoredProcedure1.ExecProc; // throws an error

The message says the command must be prepared again because the param
type has been changed to ftBytes. This occurs whether I manually set the
field type to ftGUID or leave it as ftBytes. Apparently the assignment
statement changes the field type to ftGUID.

It is possible to work around this by converting the GUID from a TGUID
record to an ANSIString with CopyMemory and then using the ANSIString in
the assignment statement, but it's ugly.

Is it possible to get the component to accept the AsGUID assignment and
then execute without errors?

Obviously, if Embarcadero would support GUID as an Interbase datatype,
we wouldn't have to fuss with all of this rigmarole, but alas, they seem
to have problems handling 16 bytes of binary data!

Milan Vydareny
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02