From: Christopher W. <chr...@ad...> - 2003-05-29 17:52:20
|
I'll try that...Thanks! On Thu, 2003-05-29 at 13:47, Carlos Guzman Alvarez wrote: > Hello: > > > It doesn't seem that efficient, but I solved the problem by iterating > > over the byte[] contents in a loop and appending the result of > > (char)byte[i] to a StringBuilder instance. > > > Why do not try using Encoding.Default.GetString(...) ??? > > > > > FbDataReader reader = > > m_daSinks.SelectCommand.ExecuteReader(); > > > > byte[] buff1, buff2; > > while( reader.Read() ) > > { > > > > buff1 = ASCIIEncoding.Default.GetBytes( > > reader.GetString( 0 ) ); // Binary data is in first column > > > > buff2 = new byte[ reader.GetInt16( 1 )]; // > > Actual Length of the binary data > > > > Array.Copy( buff1, 0, buff2, 0, buff2.Length ); > > > > object[] vals = new Object[]{ reader.GetInt64(2), > > buff2, DateTime.Now, EventName }; > > ds.Tables["tb_sinks"].LoadDataRow( vals, true ); > > } > > > > reader.Close(); > > > Huummmm ... anything like this > > > int bufLen = 0; > byte[] buff1, buff2; > while( reader.Read() ) > { > buff1 = new byte[reader.GetInt16( 1 )] > // Use here the encoding you need > Endcoding.Default.GetBytes( > reader.GetString( 0 ), 0, buff1.Length, buff1, 0 ); > > object[] vals = new Object[]{ reader.GetInt64(2), > buff2, DateTime.Now, EventName }; > ds.Tables["tb_sinks"].LoadDataRow( vals, true ); > } > > > > |