error import excel to mssql. “Fatal error: Uncaught exception 'com_exception' with message”

i'm working on a project which is allowing a user to upload an excel file, and when the user click submit, the data from the excel file will get into MSSQL database. for now, the upload is working, but it couldn't get into the MSSQL database.

i've used the same script before and it worked fine (Windows XP). now that i've changed my machine to Windows 7, i get that COM error. i've tried almost everything that i could get online (the dcomcnfg configuration), but none is helping.

pls help.

below are the error message:


<pre>
Application name: Microsoft Excel

Loaded version: 14.0

function import-->open below filename: 
C:/xampp/htdocs/www/mysystem/tmp/import_excel_0.32887000 1336015991.xls

Fatal error:  Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft Excel<br/><b>Description:</b> Microsoft Excel cannot access the file 'C://xampp/htdocs/www/mysystem/tmp/import_excel_0.32887000 1336015991.xls'. There are several possible reasons:

• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.' in C:\xampp\htdocs\www\mysystem\import\ImportData.php:52
Stack trace:
#0 C:\xampp\htdocs\www\mysystem\import\ImportData.php(52): variant->Open('C:/xampp/htdocs...')
#1 C:\xampp\htdocs\www\mysystem\import\ImportData.php(19): Import('C:/xampp/htdocs...')
#2 C:\xampp\htdocs\www\mysystem\index.php(698): require('C:\xampp\htdocs...')
#3 {main}
  thrown in C:\xampp\htdocs\www\mysystem\import\ImportData.php on line 52

Answers


Ok this solved it for me

if you’ve got IIS configured try this:

  • Run “dcomcnfg” to get to Component Services
  • Open Component Services > Computers > My Computer > DCOM Config
  • Search for Microsoft Excel Application or the appropriate application you working with on COM
  • Right-Click on it and open the properties
  • Choose “Identity” tab
  • Normally this is set to “the launching user” by default. You have to change this to “the interactive user”.
  • Apply these new settings and test your COM application. It should work fine now.

http://www.php.net/manual/en/class.com.php


Need Your Help

how to use vb variable in SQL statement in ASP?

sql asp-classic vbscript

How to use variables declared in the asp VB can be used in the SQL statement for classic ASP?

How to handle child SIGFPE/SIGILL signals using subprocess and preexec_fn?

python signals subprocess

On Linux I have an executable I wish to run via Python script. The executable divides by zero, and I can't seem to handle the signal from subprocess.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.