I have table with varbinary(MAX) parameter. After executing the query, i will store the result in SqlDataReader as it has multiple columns as output.
SqlCommand cmd = new SqlCommand("select leave_details from LeaveTable");
SqlDataReader obj;
con.Open();
obj = cmd.ExecuteReader();
Now I want to convert the result for each row into byte[].
This one is not working : :
byte[] b=null;
obj.GetBytes(0,0,b,0,1024);
Try GetValue()
method.
byte[] b=null;
b=(byte [])obj.GetValue(0);
//OR
b=(byte [])obj[0];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With