byte[]转为string (急,在线等)
openFileDialog1.Filter = "jpg files (*.jpg) ¦*.jpg";
openFileDialog1.DefaultExt = "jpg";
openFileDialog1.ShowDialog();
FileStream fs1 = File.OpenRead(openFileDialog1.FileName);
byte[] content = new byte[fs1.Length];
fs1.Read(content, 0, content.Length);
fs1.Close();
Sqlcon sql1 = new Sqlcon();
SqlConnection Conn = sql1.ConnDb();
string strSql1 = "Update Ryzd Set image_f='" + content + "' Where ID_F='000001'";
Conn.Open();
SqlCommand sc1 = new SqlCommand(strSql1, Conn);
sc1.ExecuteNonQuery();
Conn.Close();
上面代码的意思是将图片保存到SQL,但直接UPDATE content到SQL,只有16位,想将content由Byte[]转为string
我想问一下如何将byte[]的值转为string
我试过用for循环来做,但太慢了
请问有什么办法来做吗?