internal object GetPropertyValue(Guid propertySet, int propertyID) { tagDBPROP[] gdbpropArray; if (this._icommandText == null) { return(OleDbPropertyStatus.NotSupported); } System.Data.Common.UnsafeNativeMethods.ICommandProperties properties = this.ICommandProperties(); using (PropertyIDSet set2 = new PropertyIDSet(propertySet, propertyID)) { OleDbHResult result; using (DBPropSet set = new DBPropSet(properties, set2, out result)) { if (result < OleDbHResult.S_OK) { SafeNativeMethods.Wrapper.ClearErrorInfo(); } gdbpropArray = set.GetPropertySet(0, out propertySet); } } if (gdbpropArray[0].dwStatus == OleDbPropertyStatus.Ok) { return(gdbpropArray[0].vValue); } return(gdbpropArray[0].dwStatus); }
private bool PropertiesOnCommand(bool throwNotSupported) { if (this._icommandText == null) { OleDbConnection connection = this._connection; if (connection == null) { connection.CheckStateOpen("Properties"); } if (!this._trackingForClose) { this._trackingForClose = true; connection.AddWeakReference(this, 1); } this._icommandText = connection.ICommandText(); if (this._icommandText == null) { if (throwNotSupported || this.HasParameters()) { throw ODB.CommandTextNotSupported(connection.Provider, null); } return(false); } using (DBPropSet set = this.CommandPropertySets()) { if (set != null) { System.Data.Common.UnsafeNativeMethods.ICommandProperties properties = this.ICommandProperties(); Bid.Trace("<oledb.ICommandProperties.SetProperties|API|OLEDB> %d#\n", this.ObjectID); OleDbHResult result = properties.SetProperties(set.PropertySetCount, set); Bid.Trace("<oledb.ICommandProperties.SetProperties|API|OLEDB|RET> %08X{HRESULT}\n", result); if (result < OleDbHResult.S_OK) { SafeNativeMethods.Wrapper.ClearErrorInfo(); } } } } return(true); }