I'm having a problem with executing a call to the Execute method of a Connection object more than once. The first call executes fine but any subsequent calls just cause the program to stop execution. The point the program stops is the "$$STATUS = AUTOINVIKE($OBJECT, 6, invokeargs)" statement in the $Connection_Execute function. The $Connection_Execute function is contained in a module called "msado28" which was created with the Module Wizard. The commandtext for the Execute method is merely a call to a SQL Server stored procedure called Storetest which takes one string parameter and has been tested within SQL Server Management Studio.
The main program code is as below:
program storetest use msado28 implicit none integer(int_ptr_kind()) COMcnn character*120, parameter::COMcnnstr='Provider=SQLOLEDB; Data Source=mySQLServer; Initial Catalog=myDB; Trusted_Connection=Yes' integer(4) COMrtnstatus integer(int_ptr_kind()) COMexestatus type(variant) rst integer*4 i integer(4),parameter::adConnectUnspecified = -1 integer(4),parameter::adExecuteNoRecords = 128 call COMInitialize(COMrtnstatus) call &Connection_Open(COMcnn,COMcnnstr,'myUserID','myPassword',adConnectUnspecified) do i=1,10 COMexestatus=$Connection_Execute(COMcnn,"Exec Storetest 'this is a test'",rst,adExecuteNoRecords,COMrtnstatus) enddo call $Connection_Close(COMcnn,COMrtnstatus) COMrtnstatus=COMReleaseObject(COMcnn) call COMUninitialize() end program
I've expanded the range of the loop to include the COMInitialize and COMUninitialize but that didn't help.
Anyone have any ideas why the Execute method hangs on the second pass through the loop?
Thanks