gpt4 book ai didi

mysql - 使用 Delphi 和firedac 编辑MySQL 中的日期时间字段

转载 作者:行者123 更新时间:2023-11-29 10:50:50 25 4
gpt4 key购买 nike

我正在使用 Delphi 10.1 和 Firedac 组件连接到 MySQL 数据库。使用实时绑定(bind)或 VCL 数据感知组件,我可以编辑 MySQL 表中除日期之外的数据(例如发票日期)。我知道 ISO 格式的 Delphi TDateTime 和 MySQL DateTime 之间存在类型差异,但我不知道如何或在哪里进行转换?非常感谢任何帮助。

非常感谢

马特

最佳答案

您可以为 TFDConnection 添加数据类型映射,将 dtTimeStamp 映射到 dtDateTime。像这样的东西:

with FDConnection1.FormatOptions.MapRules.Add do begin
SourceDataType := dtTimeStamp;
TargetDataType := dtDateTime;
end;

关于mysql - 使用 Delphi 和firedac 编辑MySQL 中的日期时间字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43761470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com