Getting the Command Object from a Dataset

In OLE DB, the recurring theme is that there is a method on an object that returns an interface on the object that created it. For example, the method IGetDataSource::GetDatasource is a method on the session object that returns an interface pointer on the data source object that created it.

Accordingly, the dataset object needs a method that returns an interface on the command object that created it. This method is IMDDataset::GetSpecification. The word “specification” here means the object that contains the dataset specification; that is, the command object.