CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2009
    Posts
    17

    Smile Date control with SQL embeded in VC++

    Hi,

    I am doing programming with VC++ 2008, it needs to access ACCESS file with date control.

    I pasted a "Date Time Picker" in MFC project. My intent is to retreave the value of the selected date in "D/T Picker" and search in database by this value of date. How? Any better solution?

    A second question, how to transfer number between VC++ and SQL?

    Thank you.


    Sunny
    Last edited by sunnyyang; September 20th, 2010 at 07:15 AM.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Date control with SQL embeded in VC++

    Create a CRecordset derived class to access your Access table.

    Get the date from the control.

    Use the m_strFilter member of your CRecordset class to filter the records by date.

    Call Requery to select the records.

  3. #3
    Join Date
    Mar 2009
    Posts
    17

    Smile Re: Date control with SQL embeded in VC++

    Hm... That sounds the understanding in the way I am thinking of. Well, but I am still new on VC++, so would you mind to explain further?

    Thank you.

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Date control with SQL embeded in VC++

    Quote Originally Posted by sunnyyang View Post
    Hm... That sounds the understanding in the way I am thinking of. Well, but I am still new on VC++, so would you mind to explain further?

    Thank you.
    MSDN explains it better than I can. Take it a step at a time. Can you get the date from your control?

  5. #5
    Join Date
    Mar 2009
    Posts
    17

    Smile Re: Date control with SQL embeded in VC++

    Quote Originally Posted by GCDEF View Post
    MSDN explains it better than I can. Take it a step at a time. Can you get the date from your control?
    Yes, I can get the date from the control, it's an object under CString (example: 2010-9-20 or 2010920).

    I have one step from getting SQL to recognize the date format.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Date control with SQL embeded in VC++

    You need to give us some details here. How much do you have and how much do you still need?

    Are you using a CDateTimeCtrl object?
    How are you getting to your database?

  7. #7
    Join Date
    Mar 2009
    Posts
    17

    Smile Re: Date control with SQL embeded in VC++

    I am a little engaged these days. Let me get better prepared first then I answer these questions. Thank you for helping, will get back soon.

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