Open Excel file,Error

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2006
Posts: 2
Reputation: taotesea is an unknown quantity at this point 
Solved Threads: 0
taotesea taotesea is offline Offline
Newbie Poster

Open Excel file,Error

 
0
  #1
Mar 9th, 2008
Open Excel file,Error

_ConnectionPtr m_adoConn;
_RecordsetPtr m_adoRec;
::CoInitialize(NULL);
m_adoConn.CreateInstance(__uuidof(Connection));
m_adoConn->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\1.xls;Extended Properties=Excel 8.0;IMEX=1;","","",adModeUnknown);


stop this function:
inline HRESULT Connection15::Open ( _bstr_t ConnectionString, _bstr_t UserID, _bstr_t Password, long Options ) {
HRESULT _hr = raw_Open(ConnectionString, UserID, Password, Options);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}

why error
thank
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,407
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1467
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Open Excel file,Error

 
0
  #2
Mar 9th, 2008
I don't really know anything about that raw_open() function, but from this vb example the parameters are supposed to be of type _variant_t, not BSTR.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 9
Reputation: fyz is an unknown quantity at this point 
Solved Threads: 0
fyz fyz is offline Offline
Newbie Poster

Re: Open Excel file,Error

 
0
  #3
Apr 22nd, 2008
Hi,

Maybe you should check your excel file to see if it corrupts. If so, you may try Advanced Excel Repair This tool is rather useful in salvaging damaged Excel xls files.

Alan
Last edited by happygeek; Apr 22nd, 2008 at 5:49 am. Reason: link removed
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC