Other than the wiki tutorial on databases, this is my first one flying solo. All the db components are connected and set at designtime. Now while I have figured out a few things on my own, I'm having trouble creating a table during runtime. The error I'm getting is:
Project project1 raised exception class 'EDatabaseError' with message:
near "?": syntax error
with the following code:
procedure TMainForm.Button1Click(Sender: TObject);
begin
SQL1.Close;
SQL1.SQL.Text:='CREATE TABLE :TName(ID INT PRIMARY KEY NOT NULL, NAME TEXT NOT NULL, AGE INT NOT NULL, ADDRESS CHAR(50), SALARY REAL)';
SQL1.Params.ParamByName('TName').AsString:= Edit1.Text;
SQL1.Open;
end;
When I break, SQL1.Open is highlited.
Aside from using the param TName, the SQL.Text is what I'd use to create a table at the command line. I have also tried to use ?TName in place of :TName, but that gives me a different error that suggests :TName is the correct syntax. Ultimately I want to create a table for every name entered that will store a history of that person. But for now I'm using an edit box just to be able to input a name then click to create the table. And as my history will suggest, this is probably some stupid oversight on my part. But I'm trying
Anyone see what I'm doing wrong?
Kindest regards,
Landslyde