First thing, you need to learn about
parameterized query[
^]. Your current code is open for
SQL Injection[
^] and thus it can destroy your database.
Second thing, it looks like you are not using any Interop assembly to work with excel. If it's working with open and not with close, it could be that the process is taking time. If process is busy for a long time, W7 will shut it down, even though if it is still ongoing. So, try the entire operation on a backgroundworker thread and that should not save UI.
Rest, a sample app here to give a quick try and see if anything differs:
Read Write Excel file with OLEDB in C# (without Interop)[
^]
Though it might not be needed (but do try if above all fails), vshost32 error at times happens when certain APIs get affected by enabled VS hosting process. Turn it off and see:
How to: Disable the Hosting Process - Visual Studio 2015 | Microsoft Docs[
^]
More details:
"vshost32.exe has stopped working" - Learn by Insight...[
^]