我在代码中收到以下错误:
> System.Core.dll中出现未处理的“System.NotImplementedException”类型异常
附加信息:未实施方法或操作。
当我尝试在datagridview上设置数据源时会发生这种情况。错误发生在文本框上的TextChanged事件上,我试图根据输入过滤datagridview。
活动中的代码如下:
IEnumerable<b2bHdr> filteredClaims = claims.Where(sc => sc.claimNumber.ToString().Contains(ntxtClaimNoSearch.Text));
dgvHdr.DataSource = filteredClaims;
dgvHdr.AutoResizeColumns();
if (filteredClaims.Count() > 0)
{
dgvDtl.DataSource = filteredClaims;
dgvDtl.DataMember = "b2bDetails";
dgvDtl.AutoResizeColumns();
}
else
{
dgvDtl.DataSource = null;
}
错误发生在dgvDtl.DataSource = filteredClaims
行
我搜索过,找不到类似的东西。我很感激任何帮助。
b2bhdr的定义如下:
[Table(Name = "tbl_B2BHdr")]
public class b2bHdr
{
private EntitySet<b2bDtl> _b2bDetails;
public b2bHdr()
{
this._b2bDetails = new EntitySet<b2bDtl>(OnDtlAdded, OnDtlremoved);
}
private void OnDtlAdded(b2bDtl addedDtl) { addedDtl.hdrRecord = this; }
private void OnDtlremoved(b2bDtl removedDtl) { removedDtl.hdrRecord = null; }
[Association(ThisKey = "bhID", Storage = "_b2bDetails", OtherKey = "bhID")]
public EntitySet<b2bDtl> b2bDetails
{
get { return this._b2bDetails; }
set { this._b2bDetails.Assign(value); }
}
[Column(IsPrimaryKey = true, IsDbGenerated = true)] public Int32 bhID { get; set; }
[Column] public Int32 cusID { get; set; }
[Column] public int? rtHID { get; set; }
[Column] public int? inhID { get; set; }
[Column] public DateTime invoiceDate { get; set; }
[Column] public DateTime? deliveryDate { get; set; }
[Column] public Int32 referenceNumber { get; set; }
[Column] public int? claimNumber { get; set; }
[Column] public int? CreditInvoice { get; set; }
[Column] public String CustomerName { get; set; }
[Column] public Byte Type { get; set; }
[Column] public Decimal InvoiceTotal { get; set; }
[Column] public Decimal TaxTotal { get; set; }
[Column] public Int32 TempID { get; set; }
[Column] public String Notes { get; set; }
[Column] public byte? status { get; set; }
[Column] public Byte Deleted { get; set; }
以下是有关错误的调试信息:
A first chance exception of type 'System.NotImplementedException' occurred in System.Core.dll
'sldatasys.exe' (Win32): Loaded 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll'. Cannot find or open the PDB file.
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>sldatasys.exe</AppDomain><Exception><ExceptionType>System.NotImplementedException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>The method or operation is not implemented.</Message><StackTrace> at System.Linq.Enumerable.Iterator`1.System.Collections.IEnumerator.Reset()
at System.Windows.Forms.ListBindingHelper.GetFirstItemByEnumerable(IEnumerable enumerable)
at System.Windows.Forms.ListBindingHelper.GetListItemPropertiesByEnumerable(IEnumerable enumerable)
at System.Windows.Forms.ListBindingHelper.GetListItemProperties(Object list)
at System.Windows.Forms.ListBindingHelper.GetListItemProperties(Object list, PropertyDescriptor[] listAccessors)
at System.Windows.Forms.BindingContext.EnsureListManager(Object dataSource, String dataMember)
at System.Windows.Forms.DataGridView.DataGridViewDataConnection.SetDataConnection(Object dataSource, String dataMember)
at System.Windows.Forms.DataGridView.set_DataSource(Object value)
at DairyProcessing.frmB2BView.btnClearClaimSearch_Click(Object sender, EventArgs e) in c:\Data\Projects\Stonelees Data Systems\Stonelees Data Systems\Forms\frmB2BView.cs:line 223
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message&amp; m)
at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)
at System.Windows.Forms.Button.WndProc(Message&amp; m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at DairyProcessing.Program.Main() in c:\Data\Projects\Stonelees Data Systems\Stonelees Data Systems\Program.cs:line 19</StackTrace><ExceptionString>System.NotImplementedException: The method or operation is not implemented.
at System.Linq.Enumerable.Iterator`1.System.Collections.IEnumerator.Reset()
at System.Windows.Forms.ListBindingHelper.GetFirstItemByEnumerable(IEnumerable enumerable)
at System.Windows.Forms.ListBindingHelper.GetListItemPropertiesByEnumerable(IEnumerable enumerable)
at System.Windows.Forms.ListBindingHelper.GetListItemProperties(Object list)
at System.Windows.Forms.ListBindingHelper.GetListItemProperties(Object list, PropertyDescriptor[] listAccessors)
at System.Windows.Forms.BindingContext.EnsureListManager(Object dataSource, String dataMember)
at System.Windows.Forms.DataGridView.DataGridViewDataConnection.SetDataConnection(Object dataSource, String dataMember)
at System.Windows.Forms.DataGridView.set_DataSource(Object value)
at DairyProcessing.frmB2BView.btnClearClaimSearch_Click(Object sender, EventArgs e) in c:\Data\Projects\Stonelees Data Systems\Stonelees Data Systems\Forms\frmB2BView.cs:line 223
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message&amp; m)
at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)
at System.Windows.Forms.Button.WndProc(Message&amp; m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at DairyProcessing.Program.Main() in c:\Data\Projects\Stonelees Data Systems\Stonelees Data Systems\Program.cs:line 19</ExceptionString></Exception></TraceRecord>
An unhandled exception of type 'System.NotImplementedException' occurred in System.Core.dll
Additional information: The method or operation is not implemented.