I am developing a c# program that deals with an excel file and a sql server table. For now I am using a conneciton string I declare in my program but eventually want to let the user choose the file with an openfiledialog.
My question is when I add the "filepath" variable to the connection string, will it throw an error as there are no escape sequences ? If i add "@" to the start of the string can I still add the string variable to the connection string ?
Thanks in advanced. ☮ ✌
Edit: Example
For now just to get other functionality right I am using this string
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\hbudhran\Desktop\Copy of EUR SVC EUR PRICE LIST.xls; Extended Properties='Excel 8.0;HDR=YES';"
But eventually when I'm polishing my program to look and act pretty I'll want the user to browse for the excel file that he wants to insert into the DB. So the string would look like:
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath +"; Extended Properties='Excel 8.0;HDR=YES';"