2017-09-05 4 views
-2

Details of errorSystem.ArgumentNullExceptionは、」私はクリスタルレポートを印刷しようとすると、このエラーが示されているPresentationFramework.dll

で発生しました。

System.ArgumentNullExceptionは、」私は、私は別の形で同じコードを使用している 、WPFアプリケーションを構築しようとしていますし、それが正常に動作していますPresentationFramework.dll

で発生しました。 このページではエラーが表示されます。

private void btnReciept_Click(object sender, RoutedEventArgs e) 
{ 
    try { 
     if (txtComplainNo.Text == "") 
     { 
      ModernDialog.ShowMessage("Enter Complain Number","ErrorFound", MessageBoxButton.OK); 
     } 
     else 
     { 
      InsertFinalReport(); 
      var ConString = System.Configuration.ConfigurationManager.ConnectionStrings["GalaxyApp.Properties.Settings.ConnString"].ConnectionString; 
      string CmdString = string.Empty; 
      SqlCommand cmd = new SqlCommand(); 
      SqlDataAdapter MyDA = new SqlDataAdapter(); 
      DataSet myDS = new DataSet(); 
      // DataSet1 myDS = new DataSet1(); 
      SqlConnection con = new SqlConnection(ConString); 
      cmd.Connection = con; 
      cmd.CommandText = "Select * from FinalReport where ComplainNo='" + Convert.ToInt32(txtComplainNo.Text) + "'"; 
      cmd.CommandType = System.Data.CommandType.Text; 
      MyDA.SelectCommand = cmd; 
      MyDA.Fill(myDS, "FinalReport"); 
      // FinalReportDS myDS = new FinalReportDS(); 
      // myDS.EnforceConstraints=false; 
      if (myDS.Tables[0].Rows.Count == 0) 
      { 
       ModernDialog.ShowMessage("EmptyDataSet", "ErrorFound", MessageBoxButton.OK); 
      } 
      else 
      { 
       CourierReport1 rpt = new CourierReport1(); 
       rpt.SetDataSource(myDS); 
       FinalReportViewer FRV = new FinalReportViewer(); 
       FRV.ReportViewer.ViewerCore.ReportSource = rpt; 
       FRV.Show(); 
      } 
      //Report frm1 = new Report(); 
      //frm1.ReportViewer1.ViewerCore.ReportSource = rpt; 
      //frm1.Show(); 
      ///* 
      //Form1 mform = new Form1(); 
      //mform.ShowReport(Convert.ToInt32(txtComplainNo.Text)); 
      //mform.Show(); 
      //*/ 
     } 
    } 
    catch(Exception ex) 
    { 
     ModernDialog.ShowMessage(ex.Message, "ErrorFound", MessageBoxButton.OK); 
    } 
} 

私はすべての代替コードを試しました。 誰もが

Error Image

スタックトレースこのエラーの原因を見つけるために私を助けることができるしてください:

at System.Windows.Interop.WindowInteropHelper..ctor(Window window) 
    at System.Windows.MessageBox.Show(Window owner, String messageBoxText, String caption, MessageBoxButton button, MessageBoxImage icon) 
    at SAPBusinessObjects.WPF.Viewer.ViewerCore.HandleExceptionEvent(Object eventSource, Exception e, Boolean suppressMessage) 
    at SAPBusinessObjects.WPF.Viewer.ReportAlbum.OnHandleException(Exception e) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
    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 MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Windows.Threading.DispatcherOperation.Invoke() 
    at System.Windows.Threading.Dispatcher.ProcessQueue() 
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 
    at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 
    at System.Windows.Application.RunDispatcher(Object ignore) 
    at System.Windows.Application.RunInternal(Window window) 
    at GalaxyApp.App.Main() in D:\GoogleDrive\extra\GalaxyApp\GalaxyApp\obj\Debug\App.g.cs:line 0 
    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() 
Stack Trace: 
+2

すべての例外の詳細を投稿してください。いくつかの関数またはコンストラクタにnullを渡しています。 – Maritim

+0

私はまた、 –

+0

@SudhirSolkaを確認することができます画像を掲載しているこのクリスタルレポートですか?あなたの質問にタグを追加してください。 – Blacktempel

答えて

0

いくつかの場面でどんな役に立つの例外の詳細を表示しないようにCrystalReportsで少し「バグ」です。私も最近遭遇しました。

例外は基本的には何も言及していないので、例外的に見つけにくいです...問題はレポート自体ではなく、コード自体である可能性があります。
何か問題があれば、悲しいかなくデバッグしてレポートをチェックする必要があります。

すべての詳細を確認してください。
チェック使用DB-テーブルと列...

私は、サブレポートは親もいたパラメータのカップルを、持っていたこと、問題がありました。しかし、これらはサブレポートに自動的に渡されませんでした。レポートに必要なすべてのパラメータを指定する必要があります。たぶんこれもあなたを助けます。悲しいことに、レポート、コード、環境がなくても伝えるのは難しいです。

関連する問題