User-734925760 posted
Hi,
According to the error message, I suggest to check if the connectionstring is correct, you can make some break points to the application, then to debug steps by steps to check this point.
Also please refer to update the connectionstring to the code below:
string SourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + val + "';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'";
For more information, please refer to the link below:
http://www.codeproject.com/Tips/300639/Import-Data-from-excel-to-SQL-server-using-Csharp
Hope it's useful for you.
Best Regards,
Michelle Ge