嗨,我似乎无法理解这是什么问题 我一直收到我尝试使用调试器的错误消息,但似乎一切都按预期方式进行 但仍然不起作用,这里是代码
protected void btnSave_Click(object sender, EventArgs e)
{
newsParagraf n = new newsParagraf();
n.headTitle = txtHeader.Text;
n.Article = txtArticle.Text;
n.vids = txtVidLink.Text;
string photoName = "";
string extension = "";
if (FuPhoto.HasFile)
{
photoName = Guid.NewGuid().ToString();
extension = System.IO.Path.GetExtension(FuPhoto.PostedFile.FileName);
}
else
{
photoName = "Default";
extension = "jpg";
}
string fileName = photoName + "." + extension;
n.img = fileName;
db.newsParagrafs.Add(n);
db.SaveChanges();
FuPhoto.SaveAs(Server.MapPath("~/images/" + fileName))
txtArticle.Text = string.Empty;
txtHeader.Text = string.Empty;
txtVidLink.Text = string.Empty;
Search();
mvArtical.ActiveViewIndex = 0;
}
请帮助我在Webforms上使用实体框架