ACCESS图片读取出错了高人来帮忙啊
Image1.Visible = true;
OleDbConnection con = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data source= " + Server.MapPath(@ "~\App_Data\DataBase.aspx "));
string imagename = " ";
try
{
con.Open();
OleDbCommand com = new OleDbCommand( "select Pic_ID from Picture where Pic_ID= " + DropDownList1.Text + " ", con);
OleDbDataReader dr = com.ExecuteReader();
dr.Read();
MemoryStream ms = new MemoryStream((Byte[])dr[ "Pic_ID "]);
Bitmap image = new Bitmap(ms);
string filepath = Server.MapPath( "Files/ ");
DirectoryInfo dir = new DirectoryInfo(filepath);
FileInfo[] filecount = dir.GetFiles();
int i = filecount.Length;
imagename = filepath + ((i + 1) + ".jpg ");
image.Save(imagename);
dr.Close();
Image1.ImageUrl = "Files/ " + ((i + 1) + ".jpg ");
}
catch (Exception error)
{
Label1.Text = "处理失败!原因为: " + error.ToString();
}
finally
{
con.Close();
}
上面代码到 MemoryStream ms = new