C# 在表单初始化中使用后台工作程序填充TableAdapter
我正在使用后台工作程序填充TableAdapter,因为有许多记录要加载,所以在表单初始化中绑定到网格,下面是我的代码,但它在Program.cs文件中引发了一个错误!!!请帮助我处理后台工作人员,以便填充我的TableAdapterC# 在表单初始化中使用后台工作程序填充TableAdapter,c#,backgroundworker,C#,Backgroundworker,我正在使用后台工作程序填充TableAdapter,因为有许多记录要加载,所以在表单初始化中绑定到网格,下面是我的代码,但它在Program.cs文件中引发了一个错误!!!请帮助我处理后台工作人员,以便填充我的TableAdapter public OrderFRM() { InitializeComponent(); this.backgroundWorker1.RunWorkerAsync(); } private void backgr
public OrderFRM()
{
InitializeComponent();
this.backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
try
{
this.ordersTableAdapter.FillByFinancialPeriodFK(this.oxygenDataSet.Orders, PublicClass.FinancialFK);
}
catch (Exception x)
{
MessageBox.Show(this, x.Message + "\n" + x.StackTrace, x.TargetSite.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
错误消息:
详细错误为:
请注意,这是堆栈跟踪消息:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
at System.Windows.Forms.Control.WndProc(Message& m)
at Telerik.WinControls.RadControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& 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 OXYGEN.Program.Main() in D:\Oxygen\OXYGEN\OXYGEN\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
请阅读InnerException。我的表单上只有gridview!!!读取异常的InnerException。鉴于Detail@SLaks我阅读了InnerException并编辑了文章,但不明白解决方案是什么:读取InnerException的堆栈跟踪。