CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: C++ ADO sql

  1. #1
    Join Date
    May 2012
    Posts
    2

    C++ ADO sql

    Hi everybody!

    First, sorry my bad english.

    I'm trying to pass two parameters for a Recordset, in a sql query, like this:
    sql.Format("SELECT * FROM dbo_vendas WHERE vn_id = %d", m_idcTxtID);

    and it works. but a have to implement a sql with a field "date" that
    comes from a CEdit, who is filled by user.

    like this:

    sql.Format("SELECT * FROM dbo_vendas WHERE vn_id = %d and vn_date = '%s'", m_idcTxtID, m_Date);

    I have tried to convert using CTime COleTime, but nothing works.

    Can someone give some light on this?


    Thanks a lot!

  2. #2
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: C++ ADO sql

    Not exactly the same but you can get the idea from here...."ChangeDateTime" is defined as a "datetime" in SQL Server...

    Code:
    memset(szTemp, (char)NULL, sizeof(szTemp));
    sprintf(szTemp,"%2.2d/%2.2d/%4.4d  %2.2d:%2.2d:%2.2d", (sTime->tm_mon+1),sTime->tm_mday,(sTime->tm_year+1900),sTime->tm_hour,sTime->tm_min,sTime->tm_sec);
    pLocalRecordset->PutCollect(L"ChangeDateTime", _variant_t(szTemp));
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  3. #3
    Join Date
    May 2012
    Posts
    2

    Re: C++ ADO sql

    thank you, helped a lot!

  4. #4
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539

    Re: C++ ADO sql

    Glad it helped...good luck with the project....
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

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