You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using FireDAC, you must include a Cursor provider for your application to work
There are 3 cursor providers that ships with FireDAC: Forms (Vcl), FMX and Console
This is the minimal amount of code that is needed to connect to a database with FireDAC. For the sake of simplicity, I've used SQLite:
unit Unit1;
interfaceuses
System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.StdCtrls,
Data.DB,
FireDAC.Stan.Intf,
FireDAC.Stan.Option,
FireDAC.Stan.Error,
FireDAC.Stan.Def,
FireDAC.Stan.Pool,
FireDAC.Stan.Async,
FireDAC.Stan.ExprFuncs,
FireDAC.Stan.Param,
FireDAC.UI.Intf,
FireDAC.Phys,
FireDAC.VCLUI.Wait,
FireDAC.Phys.Intf,
FireDAC.Phys.SQLite,
FireDAC.Phys.SQLiteDef,
FireDAC.DatS,
FireDAC.DApt,
FireDAC.DApt.Intf,
FireDAC.Comp.DataSet,
FireDAC.Comp.Client;
type
TForm1 = class(TForm)
FDConnection1: TFDConnection;
FDQuery1: TFDQuery;
FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
Button1: TButton;
procedureButton1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation{$R *.dfm}uses
System.SysUtils;
procedureTForm1.Button1Click(Sender: TObject);
begin
FDConnection1.Params.Database := ChangeFileExt(ParamStr(0), 'sdb');
FDConnection1.Connected := True;
FDConnection1.ExecSQL('CREATE TABLE IF NOT EXISTS Test (SomeText VARCHAR(30) NOT NULL)');
FDQuery1.Open('SELECT * FROM Test ');
end;
end.
Adding FMX.Forms to the uses (either interface or uses) of the unit caused the following exception to be raised:
Object factory for class {3E9B315B-F456-4175-A864-B2573C4A2201} is missing. To register it, you can drop component [TFDGUIxWaitCursor] into your project.
The same problem can be reproduced by adding Parnassus.FMXContainer on the interface uses section. Since Parnassus.FMXContainer refers to FMX.Forms in the interface uses section it's expected that it reproduces the problem
Workaround: Add the FMX provider aswell, that is, add FireDAC.FMXUI.Wait to the interface uses section
This application works:
unit Unit1;
interfaceuses
System.Classes,
FMX.Forms,
Parnassus.FMXContainer,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.StdCtrls,
Data.DB,
FireDAC.Stan.Intf,
FireDAC.Stan.Option,
FireDAC.Stan.Error,
FireDAC.Stan.Def,
FireDAC.Stan.Pool,
FireDAC.Stan.Async,
FireDAC.Stan.ExprFuncs,
FireDAC.Stan.Param,
FireDAC.UI.Intf,
FireDAC.Phys,
FireDAC.VCLUI.Wait,
FireDAC.FMXUI.Wait,
FireDAC.Phys.Intf,
FireDAC.Phys.SQLite,
FireDAC.Phys.SQLiteDef,
FireDAC.DatS,
FireDAC.DApt,
FireDAC.DApt.Intf,
FireDAC.Comp.DataSet,
FireDAC.Comp.Client;
type
TForm1 = class(TForm)
FDConnection1: TFDConnection;
FDQuery1: TFDQuery;
FDPhysSQLiteDriverLink1: TFDPhysSQLiteDriverLink;
Button1: TButton;
FireMonkeyContainer1: TFireMonkeyContainer;
procedureFireMonkeyContainer1CreateFMXForm(var Form: TCommonCustomForm);
procedureButton1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation{$R *.dfm}uses
System.SysUtils,
System.UITypes,
FMX.Graphics;
procedureTForm1.Button1Click(Sender: TObject);
begin
FDConnection1.Params.Database := ChangeFileExt(ParamStr(0), 'sdb');
FDConnection1.Connected := True;
FDConnection1.ExecSQL('CREATE TABLE IF NOT EXISTS Test (SomeText VARCHAR(30) NOT NULL)');
FDQuery1.Open('SELECT * FROM Test ');
end;
procedureTForm1.FireMonkeyContainer1CreateFMXForm(var Form: TCommonCustomForm);
begin
Form := FMX.Forms.TForm.CreateNew(Self);
// put some color on the form, so we can actually see it
FMX.Forms.TForm(Form).Fill.Kind := TBrushKind.Solid;
FMX.Forms.TForm(Form).Fill.Color := clBlack;
Form.Show;
end;
end.
The text was updated successfully, but these errors were encountered:
When using FireDAC, you must include a Cursor provider for your application to work
There are 3 cursor providers that ships with FireDAC: Forms (Vcl), FMX and Console
This is the minimal amount of code that is needed to connect to a database with FireDAC. For the sake of simplicity, I've used SQLite:
Adding
FMX.Forms
to the uses (either interface or uses) of the unit caused the following exception to be raised:The same problem can be reproduced by adding
Parnassus.FMXContainer
on the interface uses section. SinceParnassus.FMXContainer
refers toFMX.Forms
in the interface uses section it's expected that it reproduces the problemWorkaround: Add the FMX provider aswell, that is, add
FireDAC.FMXUI.Wait
to the interface uses sectionThis application works:
The text was updated successfully, but these errors were encountered: