I was only pointing out where your error might come from, the error you are getting would be the same as doing something like
Code:
public string a;
public void DoSomething() {
int lengtOfString = this.a.Length; //debugger will spit "object reference not set to an instance of an object"
}
You will get the same error as the one you are receiving.
Reason the stirng a is declared but not initialised , so it just a variable which points to no object at this time. Only by initialising it , it will point to the object ...
Since the error comes from the first place where you want to use the object aCommand , then it means that the object aCommand is not initialised, which means you should go and take a look at the initialisation of that object which happens at
Code:
OleDbCommand aCommand = new OleDbCommand(query, aConnection);
So how is it then possible that this object not correctly initialised ... probably by the parameters you use at the object's constructor.