Hi, everyone this is my issue I have to read a binary record from the database and concatenate another string to it, the thing is that is just working one way, I ll put some code to explain better.
buffer = rdGetBinary.GetInt32(3);//this is the length of the actual row from the database. byte outbyted = new byte[buffer]; startindex = 0; retvale = rdGetBinary.GetBytes(2, startindex, outbyted, 0, buffer); string bina = System.Text.Encoding.ASCII.GetString(outbyted); string Combined = ""; Combined = bina.Replace("Q.A","Q.C")+ "\n\n" + PreBina; //which PreBina is another string variable, now this is working but if i do this Combined = PreBina + "\n\n" + bina.Replace("Q.A","Q.C") will not work. SqlCommand UpdateBinary = new SqlCommand(); long buffert = (long)Combined.Length; byte photo = new byte[buffert]; photo = System.Text.Encoding.UTF8.GetBytes(Combined); UpdateBinary.CommandText = "UPDATE OPERATION_BINARY SET BITS = @Photo, BITS_LENGTH = '" + photo.Length + "' WHERE WORKORDER_BASE_ID = '" + dsGetOperation.Tables.Rows[i].ToString() + "' AND WORKORDER_LOT_ID = '" + dsGetOperation.Tables.Rows[i].ToString() + "' AND WORKORDER_TYPE = 'M' AND SEQUENCE_NO = '" + PreSeq + "'"; UpdateBinary.Connection = conne; UpdateBinary.Parameters.Add("@Photo", SqlDbType.Image, photo.Length).Value = photo; conne.Open(); UpdateBinary.ExecuteNonQuery(); conne.Close();
I really do not understand this behavior, I just post it just in case somebody occasionally have had this issue before.