Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Set a byte array on a sqlserver database ?

How to Set a byte array on a sqlserver database ?

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharpdatabasecomdata-structures
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    betedesvosges
    wrote on last edited by
    #1

    Hello, I want to set a byte array on a sqlserver database with ado.net but i have an error message : Cannot convert 'signed char *' to 'System::Object ^' What is wrong ? Thanks in advance

    // Connexion
    SqlConnection ^connection = gcnew SqlConnection(connectString);
    connection->Open();
    
    // Requete
    String ^ myRequete = "UPDATE COM\_PKCS12 SET PKCS12 = @myPKCS12 WHERE ID = '" + System::Convert::ToString(id) + "'";
    
    // Objet Command
    SqlCommand ^command = gcnew SqlCommand( myRequete, connection);
    
    //Datas
    SByte \* testByteArray = pkcs12Data->array;
    
    // Parameters
    command->Parameters->Add(gcnew SqlParameter("@myPKCS12", SqlDbType::VarBinary));
    command->Parameters\["@myPKCS12"\]->Value = testByteArray;
    
    // Execution
    int affectedrows = command->ExecuteNonQuery();
    
    // Fermeture connection
    connection->Close();
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups