Solved

VB 4.0 & Informix 6.0 DateTime Query

Posted on 1998-06-07
2
584 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

749 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