我正在用C#开发一个aps.net网站,我正在使用框架4.在创建一个新的网站项目后,我尝试运行该项目.但我得到以下错误
Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myfirst\159977c5\b9e740fc\App_global.asax.yfqtni9g.dll' or one of its dependencies. The system cannot find the file specified.
我已经通过以下链接[和所有谈到访问该文件夹],但我没有帮助我:(
无法加载文件或程序集'file:/// C:\ WINDOWS\Microsoft.NET\Framework\v4.0.30319\asp.net vs2010 ASP.NET损坏程序集"无法加载文件或程序集App_Web_*" http://web.archive.org/web/20101023213019/http://www.yetanotherdeveloper.com/post/2008/08/10/Could-not-load-file-or-assembly-App_Web.aspx我检查并完全访问"临时ASP.NET文件"及其用户组的子文件夹和文件.
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
我目前正在使用Entity Framework 5开发C#Winforms应用程序。
我的问题是如何对绑定到的项目进行删除(仅将isDeleted字段标记为true)。bindingsourceentity
这是我的表单的屏幕截图:
该DataGridView必然enrollmedsBindingSource。请参阅以下表单加载代码,该代码填充绑定源:
private void EnrollMedicationFrm_Load(object sender, EventArgs e)
{
context.enrollmeds.Where(adm => adm.FK_Admission == _SelectedPKAdm && adm.isDeleted == false).ToList();
enrollmedsBindingSource.DataSource = context.enrollmeds.Local;
}
Run Code Online (Sandbox Code Playgroud)
如您在上面的代码中看到的,我过滤了数据以仅显示isDeleted设置为false 的数据。
以下是我的删除按钮的代码:
private void DeleteBtn_Click(object sender, EventArgs e)
{
if (enrollmedsDataGridView.CurrentRow == null)
{
MessageBox.Show("No item selected.", "System Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
enrollmedsBindingSource.Remove(enrollmedsBindingSource.Current);
}
}
Run Code Online (Sandbox Code Playgroud)
如果我调用context.SaveChanges();保存按钮,此代码将从数据库中删除该项目。
以下是保存按钮的代码:
private void SaveBtn_Click(object sender, EventArgs e)
{
this.enrollmedsBindingSource.EndEdit();
context.enrollmeds.Local
.Where(a …Run Code Online (Sandbox Code Playgroud)