Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
with qry1 do
begin
SQL.Clear;
SQL.Add('ALTER TABLE TableName ADD COLUMN FieldName VarChar(50)');
ExecSQL;
end;
with qry1 do
begin
SQL.Clear;
SQL.Add('ALTER TABLE TableName ADD COLUMN FieldName integer)');
ExecSQL;
end;
with qry1 do
begin
SQL.Clear;
SQL.Add('ALTER TABLE TableName ADD COLUMN FieldName memo)');
ExecSQL;
end;
procedure CopyParadoxDateToSqlDate;
//add 2 fields from PDox to SQL
var
InvNo: string;
InvDate: TDateTime;
DateStr: string;
s: string;
begin
//assume pardox table 'Invoice' is open for read
//assume SQL table name is 'SqlInvoice'
//assume both table have the same field names
InvNo:= Invoice.FieldByName('InvNo').AsString;
InvDate:= Invoice.FieldByName('InvDate').AsDateTime);
DateStr:= FormatDateTime('yyyy-mm-dd', InvDate);
Query1.SQL.Clear;
s:= 'INSERT INTO SqlInvoice (InvNo, InvDate)';
Query1.SQL.Add(s);
s:= 'VALUES (' + InvNo + ',' + DateStr + ')';
Query1.SQL.Add(s);
try
Query1.ExecSQL;
Query1.ApplyUpdates
except
Query1.Cancel;
ShowMessage('Error occured')
end
end;
procedure CopyParadoxDateToSqlDate;
begin
//assume pardox table 'Invoice' is open for read
//assume SQL table name is 'SqlInvoice'
//assume both table have the same field names
Query1.SQL.Clear;
Query1.SQL.Add(
'INSERT INTO SqlInvoice (InvNo, InvDate) VALUES (' +
Invoice.FieldByName('InvNo').AsString + ',' +
FormatDateTime('yyyy-mm-dd',
Invoice.FieldByName('InvDate').AsDateTime) +
')');
try
Query1.ExecSQL;
Query1.ApplyUpdates
except
Query1.Cancel;
ShowMessage('Error occured')
end
end;
ALTER TABLE akonto.db ADD COLUMN regdato date
... and nothing more. It shows how to insert data into an existing date field.Maybee somebody have added a datefield and can give my a example??
Query1.SQL.Clear;
Query1.SQL.Add('ALTER TABLE SqlInvoice ADD COLUMN InvDate date');
try
Query1.ExecSQL;
Query1.ApplyUpdates
except
Query1.Cancel;
ShowMessage('Error occurred')
end;