CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2001
    Location
    ROMANIA
    Posts
    30

    MFC/DAO temporary table ???

    i don't know if this is the right place to post this, but is database related so i hope someone can help me ...

    !!! all this is done in vc++ 6.0 using MFC/DAO !!!
    i have a database with a table that has one numeric field called ID...
    in my program, i assign a string to every value of this field...
    so if the table has the following data

    1
    3
    2
    1
    2

    then my data will be in the following form

    cow
    chicken
    wolf
    cow
    wolf

    that is, every number has an assigned string.
    the problem is that i want to store only the numeric field in the table and do all the processing in the program
    so how can i have a recordset that contains the strings and to be able to sort it ?

    another example :

    i have a table that contains two fields : DATE and TEXT
    but i want to have in my program three fields : DATE, TIME, and TEXT, where DATE and TIME is extracted from the DATE field in the database.
    also i want to be able to sort by DATE or TIME in my program, so a database with folowing data

    DATE TEXT
    ---------------- -----------
    15/02/2001 12:28 Chris
    19/02/2002 15:42 George
    25/07/2003 09:48 John

    will show up like this in my program

    DATE TIME TEXT
    ---------- ----- -----------
    15/02/2001 12:28 Chris
    19/02/2002 15:42 George
    25/07/2003 09:48 John

    and i should be able to sort by DATE, or TIME, or TEXT

    i'm showing data using a CListCtrl (not virtual)

    please can somebody help me up with this ?

    thanks ! (at least for reading this)

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430
    also i want to be able to sort by DATE or TIME in my program, so a database with folowing data

    DATE TEXT
    ---------------- -----------
    15/02/2001 12:28 Chris
    ..............
    will show up like this in my program

    DATE TIME TEXT
    ---------- ----- -----------
    15/02/2001 12:28 Chris
    ..............
    1. Use such SQL to obtain Date/Time/Text:
    SELECT Format(Your_Date_Field, "Short Date") as DateOnly, Format(Your_Date_Field,"Short Time") AS TimeOnly, Your_Text_Field as YourText
    FROM YourTable;
    2. To sort by date (or by time) you should parse your texts from CListCtrl to COleDateTime values and compatre these values

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured