|
-
Dec 15th, 2010, 04:31 AM
#1
Thread Starter
Addicted Member
Uploading Problem: Excel to SQL
I received this error after I have deployed my application in the server (win 2003) but in my development pc it is working.
Code:
External table is not in the expected format.
I can upload even the excel files is more than 30MB in file size.
-
Dec 15th, 2010, 08:28 AM
#2
Re: Uploading Problem: Excel to SQL
Hello there,
You are going to have to give us a clue here, as it is not clear from what you have described, what your problem is.
Are you saying that you have a FileUpload control, that is uploading an Excel file to the server, and then you are parsing through that Excel file, and trying to import the data into an SQL Server?
Can you show us the code that you are using? Specifically, the line that is throwing the error?
Gary
-
Dec 15th, 2010, 09:03 AM
#3
Thread Starter
Addicted Member
Re: Uploading Problem: Excel to SQL
Yeah, that's right. Your assumptions is correct, that's what I am trying to do.
It doesn't throw any error or exceptions, because it is working fine in my development pc. Only the problem is, when I deploy it in the server (windows 2003) that's the problem I have received.
Actually I received that kind of error in my development pc,
Code:
External table is not in the expected format.
the workaround I have done is to insall AccessDatabaseEngine from Microsoft. After installing it, it works. But, the same code I deployed in the server, and also installed AccessDatabaseEngine in the server, this error still appears:
Code:
External table is not in the expected format.
Code:
string sConnectionString1 = "Data Source=" + location + ";" + "Provider=Microsoft.ACE.OLEDB.12.0; Extended Properties=Excel 12.0;";
OleDbConnection objConn = new OleDbConnection(sConnectionString1);
objConn.Open();
OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [Data$]", objConn);
OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
objAdapter1.SelectCommand = objCmdSelect;
DataSet objDataSet1 = new DataSet();
objAdapter1.Fill(objDataSet1, "SheetData");
DataTable dt = objDataSet1.Tables[0];
-
Dec 18th, 2010, 04:50 AM
#4
Thread Starter
Addicted Member
Re: Uploading Problem: Excel to SQL
This works fine in the development pc but after deploying it in the production it doesn't work anymore. Please help. I can't find any solutions in google.
-
Dec 18th, 2010, 01:05 PM
#5
Re: Uploading Problem: Excel to SQL
Hello,
This has to be something that is different between the two setups, your local one, and the production server. It would be good if you could instrument (i.e. adding logging to your application) your application to find out exactly where the code is breaking.
Are you aware of any other changes you had to make on your local machine.
Gary
-
Dec 20th, 2010, 03:11 AM
#6
Thread Starter
Addicted Member
Re: Uploading Problem: Excel to SQL
I can't figure out what's in my local machine that our server don't have. I'm too tired fixing this problem, I can't find any solutions anywhere.
-
Dec 20th, 2010, 03:28 AM
#7
Re: Uploading Problem: Excel to SQL
Hey,
The first part of the solution, as I have mentioned is to figure out what is different in the setups between the two servers. Only you can do this, and you won't find any help on the internet for this.
Secondly, you need to find out at exactly which point the code is breaking. The only way to do this on the server is with logging. I would highly recommend that you add logging to your application, and start looking at exactly which point the exception is thrown, this will help you narrow down the problem.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|