CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 12th, 2005, 04:52 PM
    functor functor is offline
    Junior Member
     
    Join Date: Apr 2005
    Posts: 16
    functor is an unknown quantity at this point (<10)
    Angry Getting Binary Resultset from MS SQL (ODBC)

    Hey...

    I've got a stored procedure on a MS SQL db that returns a binary value. It's 15 bytes of hex deta that i need to decode once I get it from the DB. The problem is that when i get it from the DB, it just shows up as a string of "System.Byte[]" and I can't figure out how to get to the actual binary data.

    Here is my code:

    OdbcConnection *myCon = new OdbcConnection("Driver={Sql Server};server=localhost;trusted_connection=yes;database=Test;");
    try{
    myCon->Open();
    OdbcCommand *myCmd = new OdbcCommand("{call ccGetCards}",myCon);

    OdbcDataReader *myReader = myCmd->ExecuteReader();

    while (myReader->Read())
    {
    //Binary data is in the 3rd field of the result set
    Console::WriteLine(myReader->GetValue(2)->ToString());
    }
    myReader->Close();
    }
    catch(OdbcException *myEx)
    {
    for (int i=0;i<myEx->Errors->Count;i++)
    {
    Console::WriteLine(myEx->Errors->Item[i]->Source,myEx->Errors->Item[i]->Message);
    }
    }
    myCon->Close();


    How can I get to the real data? Please help!
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 06:11 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009