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

    [RESOLVED] _variant_t

    Hi all

    i have a _variant_t (SAFEARRAY) variable which have some data.
    Code:
     _variant_t data = rs->GetRows(adGetRowsRest);
    _variant_t data have some values like
    Code:
     
    [0,0] = BSTR = 0x0017a67c "info"
    [0,1] = BSTR = 0x0017a6fc "med"
    ...
    How can i read _variant_t (SAFEARRAY) data one bye one and store in CString? or How can i convert _variant_t (SAFEARRAY) to CStringArray.
    Plz help me

  2. #2
    Join Date
    Aug 2008
    Posts
    373

    Re: _variant_t

    i am waiting for some suggestion or idia.

  3. #3
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: _variant_t

    Use SafeArrayGetElement and other set of SafeArray* functions.

    Do not have any example code, see documentation in MSDN or search for code over Internet.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: _variant_t

    Please, provide a little more clear decription of what you are doing and what you need.
    And, BTW, GetRows returns two-dimensional array, so how are you going to save its elements in one-dimensional CStringArray?
    Victor Nijegorodov

  5. #5
    Join Date
    Aug 2008
    Posts
    373

    Re: _variant_t

    Quote Originally Posted by VictorN View Post
    Please, provide a little more clear decription of what you are doing and what you need.
    And, BTW, GetRows returns two-dimensional array, so how are you going to save its elements in one-dimensional CStringArray?
    ok

    useing GetRows i am getting all name of mysql database.And now i need to add these name in lisbox. so i am try to convert _variant_t to CString.If you have any different idia then plz give me.
    Last edited by Msm; July 1st, 2009 at 07:48 AM.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: _variant_t

    Have a look at the code example in this KB article
    Victor Nijegorodov

  7. #7
    Join Date
    Aug 2008
    Posts
    373

    Re: _variant_t

    Quote Originally Posted by VictorN View Post
    Have a look at the code example in this KB article
    Thanks victorn.Your ans always help me..Thanks

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