How to resolve the error "Failure creating file" when importing an Excel 2003 file into a SQL Server 2005 table within an ASP.Net C# application using VS2010.

I am developing a C# ASP.Net 4.0 application using Excel 2003, VS2010 and SQL Server 2005.

My goal is to import an Excel 2003 file into a SQL Server 2005 table.

My company states that SQL Bulk Copy is not a company standard, so I need to find an alternate means of accomplishing my goal.

In the routine that follows, I get the error "Failure creating file"
on the statement "oconn.Open();  

System.Data.OleDb.OleDbException          Failure creating file


Do you know how I can resolve this error?

protected void Button3_Click(object sender, EventArgs e)
        {            
            OleDbConnection oconn = new OleDbConnection
                (@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=@U:\\Manual\\101-07-09-2013.xls;Extended Properties=Excel 8.0");
            try
            {
                OleDbCommand ocmd = new OleDbCommand("select * from [Bank Credits (A)]", oconn);
                oconn.Open();  
                OleDbDataReader odr = ocmd.ExecuteReader();
                string f1 = "";
                string f2 = "";
                string f3 = "";
                string f4 = "";
                string f5 = "";
                string f6 = "";
                while (odr.Read())
                {
                    f1 = valid(odr, 0);
                    f2 = valid(odr, 1);
                    f3 = valid(odr, 2);
                    f4 = valid(odr, 3);
                    f5 = valid(odr, 4);
                    f6 = valid(odr, 5);                    
                }
            oconn.Close();
            }
            catch (DataException ee)
            {                
            }
            finally
            {                
            }        
        }
zimmer9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
double check the permissions on the folder where the excel file resides. Make sure the NETWORK SERVICE account has read/write privileges
0
zimmer9Author Commented:
U:\\Manual\\101-07-09-2013.xls
-----------------------------------------
I can place files into folder U:\Manual, I can delete files in this folder and I can update files in this folder as well.
0
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you may be able to yes, but does the account that IIS uses (which i believe is the NETWORK sERVICES account) have access?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.