private int ExecuteTableDirect(CommandBehavior behavior, out object executeResult) { this.commandBehavior = behavior; executeResult = null; OleDbHResult hr = OleDbHResult.S_OK; StringMemHandle sptr = null; bool mustReleaseStringHandle = false; RuntimeHelpers.PrepareConstrainedRegions(); try { sptr = new StringMemHandle(ExpandCommandText()); sptr.DangerousAddRef(ref mustReleaseStringHandle); if (mustReleaseStringHandle) { tagDBID tableID = new tagDBID(); tableID.uGuid = Guid.Empty; tableID.eKind = ODB.DBKIND_NAME; tableID.ulPropid = sptr.DangerousGetHandle(); using (IOpenRowsetWrapper iopenRowset = _connection.IOpenRowset()) { using (DBPropSet propSet = CommandPropertySets()) { if (null != propSet) { bool mustRelease = false; RuntimeHelpers.PrepareConstrainedRegions(); try { propSet.DangerousAddRef(ref mustRelease); hr = iopenRowset.Value.OpenRowset(ADP.PtrZero, tableID, ADP.PtrZero, ref ODB.IID_IRowset, propSet.PropertySetCount, propSet.DangerousGetHandle(), out executeResult); } finally { if (mustRelease) { propSet.DangerousRelease(); } } if (OleDbHResult.DB_E_ERRORSOCCURRED == hr) { hr = iopenRowset.Value.OpenRowset(ADP.PtrZero, tableID, ADP.PtrZero, ref ODB.IID_IRowset, 0, IntPtr.Zero, out executeResult); } } else { hr = iopenRowset.Value.OpenRowset(ADP.PtrZero, tableID, ADP.PtrZero, ref ODB.IID_IRowset, 0, IntPtr.Zero, out executeResult); } } } } } finally { if (mustReleaseStringHandle) { sptr.DangerousRelease(); } } ProcessResults(hr); _recordsAffected = ADP.RecordsUnaffected; return(ODB.ExecutedIRowset); }