I would really appreciate your help on this one. I need to get this done asap and it doesnt seem to work.
I have a Sybase DB field "Long Binary" type that I'm pulling values from and trying to "decode" them and turn into regular strings.
To do this I create a byte array, read values from that Sybase field with DataReader.GetBytes into that array and then simply loop through the array to build my final string.
Simple but for some reason 30% of the time or so GetBytes returns nothing. It doesn't turn pulled in database values into the Bytes array and it's driving me nuts.
Can't figure out what's going on. Please help.
Here is my code
byte bytes = new byte[size];
reader.GetBytes(fldID, 0, bytes, 0, bytes.Length); //This for some reason doesnt populate my bytes array sometimes
foreach (byte b in bytes)
result = !b.Equals(DBNull.Value) ? result + Convert.ToChar(b) : result + "\0";