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#
  4. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved C#
6 Posts 2 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.
  • M Offline
    M Offline
    mobius111001
    wrote on last edited by
    #1

    [Message Deleted]

    W 1 Reply Last reply
    0
    • M mobius111001

      [Message Deleted]

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Most likely you set only the first element of the array to the parameter, but without seeing the code, it's quite hard to say more.

      The need to optimize rises from a bad design.My articles[^]

      M 1 Reply Last reply
      0
      • W Wendelius

        Most likely you set only the first element of the array to the parameter, but without seeing the code, it's quite hard to say more.

        The need to optimize rises from a bad design.My articles[^]

        M Offline
        M Offline
        mobius111001
        wrote on last edited by
        #3

        The byte array is declared "byte[] b = new byte[32];". I set the values with cm.Parameters.AddWithValue( "@binTrack3", b ); and cm.Parameters.Add( "@binTrack3", SqlDbType.Binary, b.Length ).Value = b; Same results. I should also add, I'm using ODBC connection to connect to Sybase and SQLClient connection to connect to SQL Server.

        W 1 Reply Last reply
        0
        • M mobius111001

          The byte array is declared "byte[] b = new byte[32];". I set the values with cm.Parameters.AddWithValue( "@binTrack3", b ); and cm.Parameters.Add( "@binTrack3", SqlDbType.Binary, b.Length ).Value = b; Same results. I should also add, I'm using ODBC connection to connect to Sybase and SQLClient connection to connect to SQL Server.

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          At a glance, that portion of the code seems fine. Just few questions. Is the column defined fixed length? If it isn't, I think you should use SqlDbType.VarBinary. You've used debugger to observe that length of b is 32 and that it has data on every element at the time when the value assignment is made? Also you could check using debugger that cm.Parameters["@binTrack3"] has the value you suspect just before calling the ExecuteNonQuery.

          The need to optimize rises from a bad design.My articles[^]

          M 1 Reply Last reply
          0
          • W Wendelius

            At a glance, that portion of the code seems fine. Just few questions. Is the column defined fixed length? If it isn't, I think you should use SqlDbType.VarBinary. You've used debugger to observe that length of b is 32 and that it has data on every element at the time when the value assignment is made? Also you could check using debugger that cm.Parameters["@binTrack3"] has the value you suspect just before calling the ExecuteNonQuery.

            The need to optimize rises from a bad design.My articles[^]

            M Offline
            M Offline
            mobius111001
            wrote on last edited by
            #5

            The column is defined as binary. Just for kicks, I tried VarBinary, but I still received the same results. I used the debugger right before ExecuteNonQuery both with SqlDbType.VarBinary and SqlDbType.Binary. It does show the 32-byte array in its entirety.

            W 1 Reply Last reply
            0
            • M mobius111001

              The column is defined as binary. Just for kicks, I tried VarBinary, but I still received the same results. I used the debugger right before ExecuteNonQuery both with SqlDbType.VarBinary and SqlDbType.Binary. It does show the 32-byte array in its entirety.

              W Offline
              W Offline
              Wendelius
              wrote on last edited by
              #6

              If the column is fixed size in the database, what's it's length in there?

              The need to optimize rises from a bad design.My articles[^]

              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