Creating Tables without OWNERS

How do I create a table in a unit (not a form)? When I try the following:-
var
    TableDefaults: TTable;
begin
    TableDefaults              := TTable.Create(Self);
I get an error - Undeclared identifier 'Self'
Am I neglecting to put a unit in the uses clause?
Eric KayAsked:
Who is Participating?
 
javiertbConnect With a Mentor Commented:
You have to include 'DbTables' unit in your uses clause.
0
 
Eric KayAuthor Commented:
The following uses clause already exists:-
uses
  SysUtils, StdCtrls, DB, Dialogs, Forms, DBTables, ExtCtrls, Classes;
however it still doesn't work.
0
 
Eric KayAuthor Commented:
The following uses clause already exists:-
uses
  SysUtils, StdCtrls, DB, Dialogs, Forms, DBTables, ExtCtrls, Classes;
however it still doesn't work.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
mheacockCommented:
Someone has to own the TTable, I believe.

How about:

    TableDefaults := TTable.Create(Form1);

You might need Form1.Handle...whatver type self is.

If this works, please reject previous answer and invite me to repost this comment as an answer.
0
 
javiertbCommented:
You have to do this:

   TableDefaults:=TTable.Create(TableDefaults);

This works.
0
 
mheacockCommented:
I stand corrected...you got an answer that works...that's most important.
0
 
javiertbCommented:
Helloooo, anybody there to grade the question?? 8-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.