Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO and ODBC newbie question! ;)

Status
Not open for further replies.

flac0

Programmer
Oct 31, 2001
22
0
0
UY
Hi!
I'm newbie in ADO and i´m trying to do a ADO connection with ODBC with a Excel file by database source... I get this example from MSDN but i can´t do it work.

In the ODBC Console I've defined a DSN=myExcel with a workbook in c:\myproject\user.xls, Provider=Microsoft Excel Driver,no UID and no PWD.

The code are crashing in line of ConnectionString. What i´m do it wrong?

:
:
_ConnectionPtr m_pConnection = NULL;

m_pConnection.CreateInstance( __uuidof(Connection) );

m_pConnection->ConnectionString = "DSN=myExcel;UID=;PWD=";

m_pConnection->Open("","","",adConnectUnspecified);
:
:

Thanks in advance...gabriel!

----------------------------------------
Other world it´s possible. Keep on fighting! >;)
----------------------------------------
 
_ConnectionPtr m_pConnection = NULL; //pointer m_pConnection is NULL here

//This line can't make m_pConnection != NULL
m_pConnection.CreateInstance( __uuidof(Connection) );

//You use a NULL pointer m_pConnection here - it will not work
m_pConnection->ConnectionString = "DSN=myExcel;UID=;PWD=";

//You use a NULL pointer m_pConnection here - it will not work
m_pConnection->Open("","","",adConnectUnspecified);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top