图像的数据类型是Varchar(max)sqlserver,有人可以帮助我吗?
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
PCode.Text = row.Cells[0].Value.ToString();
Des.Text = row.Cells[1].Value.ToString();
Pprice.Text = row.Cells[2].Value.ToString();
comboBox1.Text = row.Cells[3].Value.ToString();
var test = (Byte[])(row.Cells["Img"].Value);
var stream = new MemoryStream(test);
pb.Image = Image.FromStream(stream);
var path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
path = path.Substring(6);
path = path + "\\images" + "/" + test;
File.Copy(imgLocation, path);
}
}