把2012-10-9 12:52:40 插入数据库后显示成41120.6748734028
procedure TMainForm.Button1Click(Sender: TObject);
var
DT: string;
//DT2: string;
begin
DT := FormatDateTime('yyyy-mm-dd',DTP.Date);
//DT2 := FormatDateTime('hh-mm-ss',DTP2.Time);
with qryScore do
begin
Close;
SQL.Clear;
SQL.Text := 'INSERT INTO Tim (DatTim) VALUES (#'+DT+'#)';
ExecSQL;
end;
end;
procedure TMainForm.Button1Click(Sender: TObject);
var
DT: string;
//DT2: string;
begin
DT := FormatDateTime('yyyy-mm-dd',DTP.Date);
//DT2 := FormatDateTime('hh-mm-ss',DTP2.Time);
with qryScore do
begin
Close;
SQL.Clear;
SQL.Text := 'INSERT INTO Tim (DatTim) VALUES (#'+DT+'#)';
ExecSQL;
end;
end;
sCreateTime: string;begin
sCreateTime := FormatDateTime('YYYY-MM-DD HH:MM:SS', now); with qryScore do
begin
Close;
SQL.Clear;
SQL.Text := 'INSERT INTO Tim (DatTim) VALUES (' + QuotedStr(CreateTime) + ')';
ExecSQL;
end;end;