Solved: “The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine” error when connecting to Access via C#

As you want to connect Microsoft Access database on Visual Studio (by clicking “Connect to Database” button on “Server Explorer” console), you may face this error:

“The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine”

Incompatiblity error between Office and Visual Studio
Incompatiblity error between Office and Visual Studio

Cause

This error shows up because your Operating System and Office installation have different platform types (32bit, 64bit). It ends up with different Visual Studio platform type.

Solution

Follow these steps:

How to find actual item count in the C# array?

We use arrays to hold more than 1 values at programming languages. For this reason, we need a lot of array methods like counting items. There is a simple method to find how many items an array has out:

string[] strArray = new string[50];
strArray[0] = "a";
strArray[1] = "b";
strArray[2] = "c";
strArray[3] = "d";
int result = strArray.Length;

result variable takes 50. This is the number that shows how many values the array can hold but we need how many values the array actually hold? We need 4 instead of 50.

Here is the code for our purpose:

int result = strArray.Count(s => s != null);

If you use integer array, It would be:

int?[] intArray = new int?[30];
intArray[0] = 5;
intArray[1] = 15;
int result2 = intArray.Count(i => i.HasValue);

More information: 

What is APN? How to change it?

APN (Access Point Names) means a network or carrier that your cell phone or tablet accesses for data. It describes which wireless network you are using when you try to connect a telecom operator such as AT&T, Verizon, T-Mobile etc. It also defines your IP address type or security mechanism.

You may need to change your sim card’s APN for several reasons (Especially for testing purposes). The way to change APN depends on your device:

  • iPhone: Settings > General > Network > Cellular Data Network
  • iPad: Settings > Cellular Data > APN Settings
  • Android: Go to Settings > Wireless & Network > Mobile Networks > Access Point Names
  • PC: Use your carrier special application. For example, It is AirCard Watcher If you are using Sierra Wireless Data Card. You can change it when internet is disconnected. After changing it, you must unplug and plug it in again (It is called Power Cycle). Don’t forget to change “Connection type“. It must be “Autoconnect“.
Changing APN on Sierra Wireless Data Card