首页 > 代码库 > 获得数据库image图片二进制
获得数据库image图片二进制
/// <summary>
/// 获得图片二进制
/// </summary>
/// <param name="unit_sn">登录用户名</param>
/// <returns></returns>
public string GetNameImageFromEmr(string unit_sn)
{
string sqlCMD = string.Format("Select User_Name_Pic From user_pic Where unit_sn=‘{0}‘", unit_sn);
DataTable dt = SqlDBHelper.ExcuteDataTable(sqlCMD);
foreach (DataRow row in dt.Rows)
{
foreach (DataColumn col in dt.Columns)
{
object obj = row["User_Name_Pic"];
byte[] dd = (byte[])obj;
string val = BitConverter.ToString(dd).Replace("-", "");
Console.WriteLine(val);
return val;
}
}
return "";
}
获得数据库image图片二进制