Failed to upload Excel data to database
<p>I have developed an ASP.NET website which uploads an Excel file and puts its data in the database. This works perfectly on my system but when I run it on the server, it fails.  I didn't get any error message. The page is showing the error <code>"Server Error in '/' Application."</code>  when I upload the Excel file.  The file name reached the upload folder. Its name is entered in the database, but data fails.
Thanks in advance.</p>

<p>The code showing error:</p>

<pre><code>    string excelConnectionString = "provider=Microsoft.jet.oledb.4.0;data source=" + xlspath + ";extended properties='Excel 8.0;HDR=YES;'";
    OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
    excelConnection.Open();
    OleDbCommand ocmd = new OleDbCommand("Select * from [sheet$]", excelConnection);
    OleDbDataReader odr = ocmd.ExecuteReader();
    string name = FileUpload1.FileName;
    string Customer = "";
    string DPS = "";
    string FSC = "";
    string FFSC = "";
    string FFSR = "";
    string DPC = "";
    string RAG = "";
    string Comments = "";

    while (odr.Read())
    {
        Customer = valid(odr, 0);
        DPS = valid(odr, 1);
        FSC = valid(odr, 2);
        FFSC = valid(odr, 3);
        FFSR = valid(odr, 4);
        DPC = valid(odr, 5);
        RAG = valid(odr, 6);
        Comments = valid(odr, 7);
        insertdataintosql(name, Customer, DPS, FSC, FFSC, FFSR, DPC, RAG, Comments);
    }
    excelConnection.Close();
    Label2.Text = "File Uploaded Sucessfully";
    Label2.Visible = true;  
</code></pre>
