Ticket KA18613
Visible to All Users

UniDAC in Server Mode

created 12 years ago (modified a year ago)

Description:
Is it possible to connect UniDac components to a server mode Grid view?

Answer:
Yes, it is possible to make our TdxServerModeCustomDataSource class support UniDAC. It is sufficient to override some of TdxServerModeCustomDataSource methods to implement this functionality. Attached is a .pas file that shows how it can be done. Just add this unit to the uses section of your project and write the code similar to the following:

Delphi
unit uMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, dxServerModeUniDACDataSource, dxServerModeSQLAdapters, DBAccess, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, DB, StdCtrls, cxGridLevel, cxClasses, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridServerModeTableView, cxGrid, Uni, UniProvider, SQLServerUniProvider; type TForm2 = class(TForm) btCreateUniDACDataSource: TButton; cxGrid: TcxGrid; cxGridLevel: TcxGridLevel; cxGridServerModeTableView: TcxGridServerModeTableView; UniConnection: TUniConnection; procedure btCreateUniDACDataSourceClick(Sender: TObject); private FDataSource: TdxServerModeUniDACDataSource; public property DataSource: TdxServerModeUniDACDataSource read FDataSource; end; var Form2: TForm2; implementation {$R *.dfm} procedure TForm2.btCreateUniDACDataSourceClick(Sender: TObject); begin btCreateUniDACDataSource.Enabled := False; FDataSource := TdxServerModeUniDACDataSource.Create(Self); DataSource.Connection := UniConnection; DataSource.SQLAdapterClass := TdxServerModeMSSQLAdapter; DataSource.TableName := 'ServerModeGridTableDemo'; DataSource.Active := True; cxGridServerModeTableView.DataController.DataSource := DataSource; cxGridServerModeTableView.DataController.CreateAllItems; end; end.

Note that this is just a draft approach that can be modified as your needs dictate.
P.S.: We recommend you always use parametric queries when you work with the UniDAC connection.

See also:
The custom solution provided by Robert N Harris:
UniDAC in Server Mode - Custom solution

The custom solution provided by Michael Schumann:
cxGrid Servermode Unidac 6.4.16 and Firebird 3

The custom solution provided by Andrzej Kulakowski:

D:\SPEED.3.0\DevExpress.zip

Show previous comments (10)

    I am lost now Paulo which solution works - what do I need to do?

    DevExpress Support Team 11 years ago

      The solution demonstrated in this Knowledge Base article (how to use UniDAC DB with our Server Mode in Delphi) still works in the latest version of our controls (VCL 13.2.3). However, if you are using C++Builder, than it is necessary to adapt this solution by yourself because we do not have a C++ counterpart for this sample.

        Thanks - I ended up implementing my own servermode as I suggested in this post four years ago
        http://www.devexpress.com/Support/Center/Question/Details/Q272253

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.