/// <summary>
/// 將照片轉換為二進制數組
/// </summary>
/// <param name=
/// <returns></returns>
private byte[] PhotoToArray( string path )
{
FileStream stream = new FileStream( path
byte[] bufferPhoto =new byte[stream
stream
stream
stream
return bufferPhoto ;
}
//把二進制的圖片插到數據庫
private void Save(byte[] image)
{
string sql =
SqlParameter[] param=new SqlParameter[
param[
param[
param[
param[
SqlConnection conn= new SqlConnection();
conn
SqlCommand commd= new SqlCommand(sql
commd
commd
try
{
conn
commd
MessageBox
}
catch(Exception ex)
{
throw ex;
}
finally
{
conn
}
}
From:http://tw.wingwit.com/Article/program/SQL/201311/16384.html