Odbc Paradox 驱动程序 WHERE 子句 日期

发布于 2024-07-16 06:44:58 字数 599 浏览 3 评论 0原文

我正在使用带有 Paradox 的 Odbc 驱动程序。 我有一张表,里面有日期。 我正在尝试按该列中的日期进行查询。 我似乎无法让 where 子句发挥作用。 我可以通过整数搜索记录,但我不知道如何使用日期时间。

OdbcCommand comm= new OdbcCommand("SELECT * FROM  [Journal]  WHERE" + 
                                  "[Date] = 04/02/2009 ",
                                  new OdbcConnection(@"Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;DefaultDir=d:\\ics\\tables\\HISTORY;Dbq=d:\\ics\\tables\\HISTORY;CollatingSequence=ASCII"));

OdbcDataAdapter adapt = new OdbcDataAdapter(comm);
DataTable table = new DataTable();
adapt.Fill(table );

I am using an Odbc driver with Paradox. I have a table with a date in it. I am trying to query by the date in that column. I can't seem to get the where clause to work. I can get the record searching by ints, but I don't know how to use the date time.

OdbcCommand comm= new OdbcCommand("SELECT * FROM  [Journal]  WHERE" + 
                                  "[Date] = 04/02/2009 ",
                                  new OdbcConnection(@"Driver={Microsoft Paradox Driver (*.db )};DriverID=538;Fil=Paradox 5.X;DefaultDir=d:\\ics\\tables\\HISTORY;Dbq=d:\\ics\\tables\\HISTORY;CollatingSequence=ASCII"));

OdbcDataAdapter adapt = new OdbcDataAdapter(comm);
DataTable table = new DataTable();
adapt.Fill(table );

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

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

发布评论

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

评论(2

蝶…霜飞 2024-07-23 06:44:58

好吧,我想通了。

...where   [Date] = {d 'yyyy-MM-dd'} AND...

在 odbc 中,您必须使用 {} 来定义对象,d 定义日期的格式。

您可以使用以下内容。

{d '值'} yyyy-mm-dd

{t '值'} hh:mm:ss

{ts '值'} yyyy-mm-dd hh:mm:ss

Ok I figured it out.

...where   [Date] = {d 'yyyy-MM-dd'} AND...

In odbc you have to use the {} to define an object, and the d defines the format of the date.

You can use the following.

{d 'value'} yyyy-mm-dd

{t 'value'} hh:mm:ss

{ts 'value'} yyyy-mm-dd hh:mm:ss

北音执念 2024-07-23 06:44:58

在 Paradox 中查找可将字符串转换为日期的日期/时间函数。 像在 SQL 中一样使用字符串作为日期是非常棘手的。 必须有一些像 TO_DATE 或类似的函数可以为您正确格式化它。

Look for Date/Time functions in Paradox that will convert a string to a date. It is very tricky to use a String as a date like in your SQL. There must be some functions like TO_DATE or similar that will properly format it for you.

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