SDAC

TMSUDTField.AsUDT Property

Used to access properties and methods of CLR User-defined Types (UDT) from the Win32 applications.

Class

TMSUDTField

Syntax

property AsUDT: Variant;

Remarks

The AsUDT property lets you access properties and methods of CLR User-defined Types (UDT) from your Win32 applications. In order to use this functionality, you should create a CLR assembly that implements your new UDT, register this assembly in SQL Server, and create a table containing a column based on your UDT. Also it is necessary to put the CLR assembly implementing your UDT into the directory with your application using SDAC, or register it in GAC.

After that you can open tables with UDT fields, cast these fields to TMSUDTField, and invoke members of your UDT through the AsUDT property.

For detailed information on what is UDT, how to create and use it, please refer to this topic of MSDN.

Note: if you use this functionality in your application, you will need to deploy the Devart.Sdac.UDTProxy.dll file along with it. This file should be present in the directory with your application, or registered in GAC. You will find this file in the Bin folder of your SDAC installation directory.

Note: This functionality has certain restrictions, like:

Example

You can open tables with UDT fields, cast these fields to TMSUDTField, and invoke members of your UDT through the AsUDT property like it is shown in the code below.

This code is taken from the UDT demo of the SDAC General demo. Please refer to this demo for an example. Also the UDT demo includes an implementation of the test UDT named Square.

var
Square: variant;
begin
MSQuery.Edit;
Square := (MSQuery.FieldByName('c_square') as TMSUDTField).AsUDT;
Square.Move(StrToInt(edBaseX.Text), StrToInt(edBaseY.Text));
MSQuery.Post;
end; 
© 1997-2019 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback