#1 2025-03-09 12:29:58

Kabiri
Member
Registered: 2024-06-22
Posts: 51

ORM+SQLServer+Create Table

Hello

I have created the ORM.
I have also established the connection to the SQL Server database.
I have created the database on the sql server(manully).
However, the CreateMissingTables() command does not create the tables.

  TMainRestServer = class(TRestServerFullMemory)
  private
    FConnectionPool: TSqlDBFireDacConnectionProperties;
    Model: TOrmModel;

and

  aServer := TMainRestServer.Create;
  aServer.Model:=TOrmModel.Create([TormUnits]);
  VirtualTableExternalRegister(aServer.Model,[TormUnits],aserver.FConnectionPool);
  HttpServer := TRestHttpServer.Create('8080', [aServer], '+', HTTP_DEFAULT_MODE,4 );
  HttpServer.AccessControlAllowOrigin := '*';
  aServer.Server.CreateMissingTables();

Which part did I do wrong?

Offline

#2 2025-03-09 21:01:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,926
Website

Re: ORM+SQLServer+Create Table

For external SQL tables, you need to use a SQLite3 engine mORMot core, not a full-memory engine.

Offline

Board footer

Powered by FluxBB