1. Matt - MSADO15.ew
- Posted by Jonas Temple <jtemple at yhti.net> Oct 27, 2004
- 1045 views
Matt, If you recall, you helped me with a problem using ADO with EuCom. You sent me an email with suggested changes to MSADO15.ew and I can't seem to put my finger on it. If you still have that email, could you resend? Thanks! Jonas Temple http://www.yhti.net/~jktemple
2. Re: Matt - MSADO15.ew
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 27, 2004
- 1026 views
Jonas Temple wrote: > > Matt, > > If you recall, you helped me with a problem using ADO with EuCom. You > sent me an email with suggested changes to MSADO15.ew and I can't seem > to put my finger on it. > > If you still have that email, could you resend? I don't have it on this machine. I'll have to take a look when I go home. Looking at what I do have here with respect to msado15.ew, it looks like I commented out some interfaces for Connection objects.
global constant Connection_clsid = "00000514-0000-0010-8000-00AA006D2EA4", Connection_clsid_ix = add_clsid( Connection_clsid) , Connection_disp = add_iid( Connection_clsid_ix, IDispatch), --Connection_IQuickActivate_ix = add_iid( Connection_clsid_ix, IQuickActivate ), --Connection_IPersistStreamInit_ix = add_iid( -- Connection_clsid_ix, IPersistStreamInit ), Connection_IConnectionPointContainer_ix = add_iid( Connection_clsid_ix, IConnectionPointContainer )
Also, I think I may have used a different IID for the event interface. Try these:
global constant ConnectionEvents = "00000400-0000-0010-8000-00AA006D2EA4", ConnectionEventsVt = "00000402-0000-0010-8000-00AA006D2EA4",
The ConnectionEventsVt doesn't seem to work, but I get events fired for the first one. Matt Lewis
3. Re: Matt - MSADO15.ew
- Posted by Jonas Temple <jtemple at yhti.net> Oct 27, 2004
- 1017 views
Matt Lewis wrote: > I don't have it on this machine. I'll have to take a look when I go home. > Looking at what I do have here with respect to msado15.ew, it looks like > I commented out some interfaces for Connection objects. > }}} <eucode> > global constant > Connection_clsid = "00000514-0000-0010-8000-00AA006D2EA4", > Connection_clsid_ix = add_clsid( Connection_clsid) , > Connection_disp = add_iid( Connection_clsid_ix, IDispatch), > --Connection_IQuickActivate_ix = add_iid( Connection_clsid_ix, IQuickActivate > ), > --Connection_IPersistStreamInit_ix = add_iid( > -- Connection_clsid_ix, IPersistStreamInit ), > Connection_IConnectionPointContainer_ix = add_iid( > Connection_clsid_ix, IConnectionPointContainer ) > </eucode> {{{ > > Also, I think I may have used a different IID for the event interface. > Try these: > }}} <eucode> > global constant > ConnectionEvents = "00000400-0000-0010-8000-00AA006D2EA4", > ConnectionEventsVt = "00000402-0000-0010-8000-00AA006D2EA4", > </eucode> {{{ > > The ConnectionEventsVt doesn't seem to work, but I get events fired for > the first one. > Matt, Thanks for the reply! What is ConnectionEventsVt used for? I didn't have that in my MSADO15.ew created by tbrowse. When I ran my test program I got the following: IUnknown::QueryInterface(80004002) Could not find implemented interface: 00000402-0000-0010-8000-00AA006D2EA4 IUnknown::QueryInterface Found implemented interface: 00000400-0000-0010-8000-00AA006D2EA4 80020009: Exception occurred. Exception Source: ADODB.Connection Exception Description: Operation has been cancelled by the user. 80020009: Exception occurred. Exception Source: ADODB.Connection Exception Description: Operation is not allowed when the object is closed. The problem is I don't know how I cancelled the operation. Do you have a working example of connection to a data source with ADO? Here's my example: with trace include eucom.ew include msado15.ew atom ado_connect, void, conn_str com_err_out(1) ado_connect = create_com_object(Connection_clsid_ix) conn_str = alloc_bstr("Provider=IBMDA400;Data Source=66.140.221.246") trace(1) void = invoke(ado_connect, {Connection_m_Open},{conn_str},{VT_BSTR},DISPATCH_METHOD) void = invoke(ado_connect, {Connection_m_Close},{},{},DISPATCH_METHOD) free(conn_str) Thanks for your help! Jonas
4. Re: Matt - MSADO15.ew
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 27, 2004
- 973 views
Jonas Temple wrote: > > Thanks for the reply! What is ConnectionEventsVt used for? I didn't have > that in my MSADO15.ew created by tbrowse. I believe that I discovered this on the web--after getting the could not find implemented interface. I believe that it's the straight vtable interface, as opposed to the dispinterface. Not certain, though. > When I ran my test program I got the following: > > IUnknown::QueryInterface(80004002) > Could not find implemented interface: 00000402-0000-0010-8000-00AA006D2EA4 > > IUnknown::QueryInterface > Found implemented interface: 00000400-0000-0010-8000-00AA006D2EA4 > > 80020009: Exception occurred. > Exception Source: ADODB.Connection > Exception Description: Operation has been cancelled by the user. > 80020009: Exception occurred. > Exception Source: ADODB.Connection > Exception Description: Operation is not allowed when the object is closed. > > The problem is I don't know how I cancelled the operation. Do you have > a working example of connection to a data source with ADO? > It seems to work if you set up a DSN and then use that as your connect string. Here's my example:
without warning include eucom.ew include msado15.ew atom ado_connect, void, conn_str com_err_out(1) ado_connect = create_com_object(Connection_clsid_ix) -- Event functions for ConnectionEvents with trace procedure ConnectionEvents_InfoMessage_proc( atom this, atom pError, atom adStatus, atom pConnection ) puts(1,"InfoMessage\n") end procedure com_event_routine( ado_connect, ConnectionEvents_InfoMessage, routine_id("ConnectionEvents_InfoMessage_proc" )) procedure ConnectionEvents_BeginTransComplete_proc( atom this, atom TransactionLevel, atom pError, atom adStatus, atom pConnection ) puts(1,"BeginTransComplete\n") end procedure com_event_routine( ado_connect, ConnectionEvents_BeginTransComplete, routine_id("ConnectionEvents_BeginTransComplete_proc" )) procedure ConnectionEvents_CommitTransComplete_proc( atom this, atom pError, atom adStatus, atom pConnection ) puts(1,"CommitTransComplete\n") end procedure com_event_routine( ado_connect, ConnectionEvents_CommitTransComplete, routine_id("ConnectionEvents_CommitTransComplete_proc" )) procedure ConnectionEvents_RollbackTransComplete_proc( atom this, atom pError, atom adStatus, atom pConnection ) puts(1,"RollbackTransComplete\n") end procedure com_event_routine( ado_connect, ConnectionEvents_RollbackTransComplete, routine_id("ConnectionEvents_RollbackTransComplete_proc" )) procedure ConnectionEvents_WillExecute_proc( atom this, atom Source, atom CursorType, atom LockType, atom Options, atom adStatus, atom pCommand, atom pRecordset, atom pConnection ) puts(1,"WillExecute\n") end procedure com_event_routine( ado_connect, ConnectionEvents_WillExecute, routine_id("ConnectionEvents_WillExecute_proc" )) procedure ConnectionEvents_ExecuteComplete_proc( atom this, atom RecordsAffected, atom pError, atom adStatus, atom pCommand, atom pRecordset, atom pConnection ) puts(1,"ExecuteComplete\n") end procedure com_event_routine( ado_connect, ConnectionEvents_WillConnect, routine_id("ConnectionEvents_ExecuteComplete_proc" )) procedure ConnectionEvents_WillConnect_proc( atom this, atom ConnectionString, atom UserID, atom Password, atom Options, atom adStatus, atom pConnection ) puts(1,"WillConnect\n") end procedure com_event_routine( ado_connect, ConnectionEvents_WillConnect, routine_id("ConnectionEvents_WillConnect_proc" )) procedure ConnectionEvents_ConnectComplete_proc( atom this, atom pError, atom adStatus, atom pConnection ) puts(1,"ConnectComplete\n") end procedure com_event_routine( ado_connect, ConnectionEvents_ConnectComplete, routine_id("ConnectionEvents_ConnectComplete_proc" )) procedure ConnectionEvents_Disconnect_proc( atom this, atom adStatus, atom pConnection ) puts(1,"Disconnect\n") end procedure com_event_routine( ado_connect, ConnectionEvents_Disconnect, routine_id("ConnectionEvents_Disconnect_proc" )) conn_str = alloc_bstr( "DSN=weapons;" ) void = invoke( ado_connect, {Connection_p_ConnectionString}, {conn_str}, {VT_BSTR}, DISPATCH_PROPERTYPUT ) void = invoke(ado_connect, {"Open"},{},{},DISPATCH_METHOD) ? invoke(ado_connect, {"State"}, {},{}, DISPATCH_PROPERTYGET ) void = invoke(ado_connect, {Connection_m_Close},{},{},DISPATCH_METHOD) free_bstr(conn_str) abort(wait_key())
To set up a dsn, go to (Win2K/XP): Control Panel -> Administrative Tools -> Data Sources (ODBC) In Win9X, I believe that the ODBC option is right there in Control Panel. Matt Lewis
5. Re: Matt - MSADO15.ew
- Posted by Jonas Temple <jtemple at yhti.net> Oct 27, 2004
- 940 views
Matt Lewis wrote: > It seems to work if you set up a DSN and then use that as your connect > string. Here's my example: Actually, I used an ADO provider, not an ODBC connection! Your code worked for me! I changed the connection string to: conn_str = alloc_bstr("Provider=IBMDA400;Data Source=66.140.221.246;") and it connected. After playing around with this for a while what I figured out was that my problem was I didn't have routines for the COM events. It seems to me that even if the routines don't do anything, they are still required. Is this true? Thanks again for your help! Jonas Temple http://www.yhti.net/~jktemple
6. Re: Matt - MSADO15.ew
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Oct 27, 2004
- 965 views
Jonas Temple wrote: > > After playing around with this for a while what I > figured out was that my problem was I didn't have routines for the COM > events. It seems to me that even if the routines don't do anything, > they are still required. Is this true? > It shouldn't be. The events should call the event_invoke() routine in EuCOM, and then EuCOM looks for any event handlers that you've set up and calls it if it exists. But then I'm always finding that anything COM related behaves in ways I wouldn't have guessed. Matt Lewis