I was looking for how to extract binary data from a database. My query works fine as it shows binary data in SQL manager.
But in Visual Studio 2010, it just shows me <Binary Data>which, as I personally think, is not a problem, but if I try to restore it and save it in a variable, it is simply empty. Any other query works as long as it has nothing to do with binary data ...
And I do not want to use datagrid or anything else, since I only need this as a variable.
SqlCommand CMDbinary = new SqlCommand("SELECT Binary_field AS binary "
+ "FROM BIN_table", abc_conn);
SqlDataReader Bin_retriever = CMDbinary.ExecuteReader();
while (Bin_retriever.Read())
{
BIN.Add(Bin_retriever["binary"].ToString());
}
abc_conn.Close();
I know that this is not complete code, but everything goes wrong here, I suppose I need to do something special to display binary information, since (I will say it again) it works if I change Binary_fieldto UID(which is varcharin the database).
Any help on this is really appreciated, thanks in advance!
source
share