Error
I get the Object reference not set to an instance of an object exception
Error probably occurs when object you are assigning is not initialized,
before making any of the operation with particular object make sure that it is not null,
Here
ds.Tables[0].DefaultView;
May not have been initialized,
Make sure that object of DataSet is initialized properly,
Please
vote and
Accept Answer if it Helped.