Solved

VB 4.0 & Informix 6.0 DateTime Query

Posted on 1998-06-07
2
575 Views
Last Modified: 2008-02-26
I have a Informix 6.0 and VB 4.0 and used  ODBC. I can use sql query for returning recordset of text, integer and other data field.
My problems is how to query DateTime data fields. My date fields is in yyyy/mm/dd hh:nn:ss formats in Informix.

0
Comment
Question by:sujatha060198
2 Comments
 
LVL 4

Accepted Solution

by:
yowkee earned 50 total points
ID: 1462751
Just treat it as string.
For example, there is a table

Create table TabTest
(
  MyDate  DATETIME
)

SQL statement for query for the datetime field,

  select * from TabTest
  where DATETIME = '1998/06/08 14:46:22'

eg, In you code(assume DAO)

  ' db is the database object
  Dim rst As RecordSet
  Dim sSQL As String

  sSQL = "Select * from TabTest where MyDate = '" + _
         Format(Now, "yyyy/mm/dd hh:mm:ss") + "'"
  Set rst = db.OpenRecordset(sSQL, dbOpenSnapshot, dbReadOnly)
 

 
0
 

Author Comment

by:sujatha060198
ID: 1462752
Informix datetime format also are in the format of '1998-06-08 14:46:22'. So one must make sure in which format they are before making the date time.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now