Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8243679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:35:43+00:00 2026-06-07T21:35:43+00:00

This is a .NET 2.0 application written using VS 2005. It works fine on

  • 0

This is a .NET 2.0 application written using VS 2005. It works fine on systems running .NET 2.0, but hard crashes on systems running .NET 4.0. Here’s the critical section of the code:

      string selectCommand1 = ....
      string connectionString1 = ....
      using (OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand1, connectionString1))
        {
            try
            {
                adapter.Fill(table1);
            }
            catch
            {
               MessageBox.Show("error");
            }
        }

      string selectCommand2 = ....
      string connectionString2 = ....
      using (OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand2, connectionString2))
        {
            try
            {
                adapter.Fill(table2);
            }
            catch
            {
               MessageBox.Show("error");
            }
        }

Again, it works under .NET 2.0, crashes under .NET 4.0

ConnectionStrings 1 & 2 reference different .xls files.

I found that the way around this problem is to declare and initialize a field variable of type OleDbConnection, set the ConnectionString property and Open() it before the OleDbDataAdapter’s using statement. As so:

 OleDbConnection connection = new OleDbConnection();

  .......

        connection.ConnectionString = connectionString1;
        connection.Open();
        using (OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand1, connection))
        {
            try
            {
                adapter.Fill(table1);
            }
            catch
            {
                MessageBox.Show("error");
            }
        }

        connection.Close();
        connection.ConnectionString = connectionString2;
        connection.Open();
        using (OleDbDataAdapter adapter = new OleDbDataAdapter(selectCommand2, connection))
        {
            try
            {
                adapter.Fill(table2);
            }
            catch
            {
                MessageBox.Show("error");
            }
        }

It’s hard to believe that this is the reason why my app was hard crashing (no error messages) under .NET 4.0, but after removing lines of code one at a time and recompiling over and over I found that to be the cause of the problem.

I’m glad I solved the problem, but I’m not satisfied with the fact that the first code won’t work with .NET 4.0.

Can someone please explain why .NET 4.0 doesn’t like to work with code like the one above?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:35:45+00:00Added an answer on June 7, 2026 at 9:35 pm

    The problem was “Application Verifier”. Uninstalling it solved the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running ASP.NET application written in C# and using SQL Server 2005. I
I have an application that was written in VS 2005 (C#). Works fine, it
I have a large application written using .Net remoting for file transfer. This was
there's a WinForms-application written in C# using .NET Framework 3.5. This application uses a
I have this code in my ASP.NET application written in C# that is trying
I have compiled a .NET application using Any CPU option. This .NET application uses
I have a .NET application that was written in C# and VB.NET using WinForms.
I have an application written in ASP.NET and using EF. I want to make
The situation is this. I have an application written in vb.net. it consists or
I have one C# Application written using .net framework4.0.It is working good.Now i want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.