If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Microsoft OLE DB Provider for ODBC Drivers error '80040e4e' Operation Cancelled ???

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-21-04, 12:16
ct976 ct976 is offline
Registered User
 
Join Date: Aug 2004
Posts: 26
Microsoft OLE DB Provider for ODBC Drivers error '80040e4e' Operation Cancelled ???

hi, i'm trying to import some excel data from an external file into SQL server 2000 database.

it gives me this error when i submit the file:

Microsoft OLE DB Provider for ODBC Drivers error '80040e4e'

Operation was canceled.

/dl/DLbackup/admin/npanxxBulkUpdate.asp, line 76


This is the section of the code:

line 76 is:
cnnExcel.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=" & fileName


Code:
Set cnnExcel = Server.CreateObject("ADODB.Connection")
cnnExcel.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
           "DriverId=790;" & _
           "Dbq=" & fileName


	Set rsXL = Server.CreateObject("ADODB.Recordset")
	rsXL.Open "SELECT npa_nxx,ocn,exchange_abbr FROM [Sheet1$]", cnnExcel



	Do While not rsXL.EOF
     	conn.Execute "INSERT INTO npa_nxx VALUES('" & rsXL("npa_nxx") & "', '" & rsXL("ocn") & "', '" & rsXL("exchange_abbr") & "' )"
     	rsXl.MoveNext
	Loop
how do i fix this??

Last edited by ct976; 10-21-04 at 13:23.
Reply With Quote
  #2 (permalink)  
Old 10-21-04, 19:09
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
I don't know much about connecting to Excel but I thought the syntax for the connection string was more like...
Code:
oConn.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
           "DriverId=790;" & _
           "Dbq=c:\somepath\mySpreadsheet.xls;" & _
           "DefaultDir=c:\somepath"
eg. you need the defaultdir (for the locking file I think). you might also want to check out how your filename is being structure/passed. You might need to do a MapPath on the filename to get yourself into the right directory.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On