I'm trying to write a test that returns a data-reader with one of the columns being a byte[]. I figured I can create a datatable and create a reader from that.
var cboTable = new DataTable("CBOTable");
var colValue = new SqlBinary(ASCII.GetBytes("Hello This is test"));
cboTable.Columns.Add("ByteArrayColumn");
cboTable.Rows.Add(colValue);
var reader= cboTable.CreateDataReader();
the problem is when I add colValue
to the datarow instead of adding it as a byte[]
it adds it to the row as it's string representation which is "SqlBinary(18)"
.
my question is how do I add an actual byte[]
to my datarow