我能够在gridview上看到jpeg文件,但我想要的是看图像本身。这是我的按钮代码:
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string bname = TextBox1.Text;
string city = DropDownList1.SelectedValue.ToString();
string filename = Path.GetFileName(FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath("~/Images/") + filename);
Execute("INSERT INTO building VALUES('" + bname + "','Binay',1, '" + filename + "')");
Label3.Text = "sucess";
SqlDataAdapter sda = new SqlDataAdapter("Select * from building",ConnectionString);
DataTable dt = new DataTable();
sda.Fill(dt);
GridView1.DataSource = dt;
DataBind();
}
else
{
Label3.Text = "upload image";
}
}
任何建议都会有很大帮助。谢谢!
答案 0 :(得分:0)