///
/// 将照片转换为二进制数组
///
///
///
private byte[] PhotoToArray( string path )
{
FileStream stream = new FileStream( path , FileMode.Open , FileAccess.Read ) ;
byte[] bufferPhoto =new byte[stream.Length] ;
stream.Read( bufferPhoto,0,Convert.ToInt32( stream.Length ) ) ;
stream.Flush();
stream.Close();
return bufferPhoto ;
}
//把二进制的图片插到数据库
private void Save(byte[] image)
{
string sql = "insert into table2(aaa,photo) values(@aaa,@photo)";
SqlParameter[] param=new SqlParameter[2];
param[0] =new SqlParameter("@aaa",SqlDbType.Int);
param[0].Value = 1;
param[1]= new SqlParameter("@photo",SqlDbType.Image);
param[1].Value= image;
SqlConnection conn= new SqlConnection