Hi,
The problem is here:
SqlConnection oconn = new SqlConnection("Data Source=d:\website1\example.xls; Initial catalog=master;" + Server.MapPath("Example.xls") + ";Extended Properties=Excel 8.0");
and here:
SqlConnection oconn = new SqlConnection("Data Source=d:\website1\example.xls; Initial catalog=master;" + Server.MapPath("Example.xls") + ";Extended Properties=Excel 8.0");
A backslash in a C# string must be written as a double backslash:
\\
Read more about escape sequences here:
http://msdn.microsoft.com/en-us/library/h21280bw.aspx[
^]
A
\\
is the escape sequence for a backslash. Change in your
string
s all backslashes into
\\
Hope this helps.