使用 JET 添加注释到数据库字段

发布于 2024-10-17 05:16:24 字数 623 浏览 4 评论 0原文

我正在编写一个脚本,使用 PHP 中的 Jet 引擎在线管理小型 Access 数据库。我遇到困难的一件事是向字段添加评论。直接使用 Access 非常容易,但我不知道如何通过 SQL 语句或类似的语句以编程方式完成此操作。有什么想法吗?谢谢!

编辑

我通常使用 MySQL,但 Access 有时会为较小的数据库提供一些好处。大多数情况下,我可以下载它们并将其通过电子邮件发送给人们,以用于他们需要的任何目的。

我将时间戳存储为 long int 而不是内置类型之一,因为这样在 PHP 中使用起来更容易,并且运行查询也更容易。我想在这些时间戳字段旁边添加一个简单的注释,简单地说类似 Unix Timestamp 之类的内容,这样脚本和用户都知道这是一个时间戳,而不仅仅是一个数字。我已经知道如何阅读注释,但似乎不知道在添加新字段时如何编写注释。

我使用 ADODB 和 Jet 与数据库交互,如下所示:

$conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={$db};Mode=ReadWrite;");

I am working on a script to manage a small Access database online using the Jet engine in PHP. One thing I am having trouble doing is adding a comment to a field. This is quite easy using Access directly, but I can't figure out to do it programatically through an SQL statement or something similar. Any ideas? Thanks!

EDIT

I generally use MySQL, but Access provides a few benefits from time to time for smaller databases. Mostly, I can download and email them to people to use for whatever purpose they require.

I store timestamps as a long int rather than one of the built in types because it is easier to work with in PHP that way, and a lot easier to run a query against. I want to add a simple comment next to these timestamp fields that simply says something like Unix Timestamp so both the script and user know this as a timestamp rather than simply a number. I already know how to read comments, but can't seem to figure out how to write them when adding a new field.

I am using ADODB and Jet to interact with the database like so:

$conn = new COM('ADODB.Connection');
$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={$db};Mode=ReadWrite;");

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

埋情葬爱 2024-10-24 05:16:25

您可以使用 ADOX 目录获取说明, 这似乎可以与 PHP 一起使用

在 VBA 中你可以说:

catdb.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.FullName

catdb.Tables("ATable").Columns("AColumn").Properties("Description") = "New descr"

You can get at the desciption with an ADOX Catalog, which, it seems, can be used with PHP

In VBA you could say:

catdb.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.FullName

catdb.Tables("ATable").Columns("AColumn").Properties("Description") = "New descr"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文