Skip to content

View Class

A View represents a result set obtained when processing a query using the «see M:WixToolset.Dtf.WindowsInstaller.Database.OpenView(System.String,System.Object[])» method of a «see P:WixToolset.Dtf.WindowsInstaller.View.Database» . Before any data can be transferred, the query must be executed using the «see M:WixToolset.Dtf.WindowsInstaller.View.Execute(WixToolset.Dtf.WindowsInstaller.Record)» method, passing to it all replaceable parameters designated within the SQL query string.

MethodDescription
Assign(record)Updates or inserts a Record into the View.
Delete(record)Deletes a Record from the View.
Execute(executeParams)Executes a SQL View query and supplies any required parameters. The query uses the question mark token to represent parameters as described in SQL Syntax. The values of these parameters are passed in as the corresponding fields of a parameter record.
Execute()Executes a SQL View query.
Fetch()Fetches the next sequential record from the view, or null if there are no more records.
GetEnumerator()Enumerates over the Records retrieved by the View.
Insert(record)Inserts a Record into the view.
InsertTemporary(record)Inserts a Record into the View. The inserted data is not persistent.
Merge(record)Inserts or validates a record.
Modify(mode, record)Updates a fetched Record.
Refresh(record)Refreshes the data in a Record.
Replace(record)Updates or deletes and inserts a Record into the View.
Seek(record)Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations.
Update(record)Updates the View with new data from the Record.
Validate(record)Validates a record, returning information about any errors.
ValidateDelete(record)Validates a record that will be deleted later, returning information about any errors.
ValidateFields(record)Validates fields of a fetched or new record, returning information about any errors. Can validate one or more fields of an incomplete record.
ValidateNew(record)Validates a new record, returning information about any errors.
PropertyDescription
ColumnsGets the set of columns that were included in the query for this View, or null if this view is not a SELECT query.
DatabaseGets the Database on which this View was opened.
QueryStringGets the SQL query string used to open this View.
TablesGets the set of tables that were included in the SQL query for this View.
WixToolset.Dtf.WindowsInstaller.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Updates or inserts a Record into the View.

public void Assign(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be assigned

Updates record if the primary keys match an existing row and inserts if they do not match. Fails with a read-only database. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe assignment failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Deletes a Record from the View.

public void Delete(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be deleted

The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Fails if the row has been deleted. Works only with read-write records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe deletion failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Executes a SQL View query and supplies any required parameters. The query uses the question mark token to represent parameters as described in SQL Syntax. The values of these parameters are passed in as the corresponding fields of a parameter record.

public void Execute(
Record executeParams
)
ParameterTypeDescription
executeParamsRecordOptional Record that supplies the parameters. This Record contains values to replace the parameter tokens in the SQL query.

Win32 MSI API: MsiViewExecute

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Executes a SQL View query.

public void Execute()

Win32 MSI API: MsiViewExecute

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Fetches the next sequential record from the view, or null if there are no more records.

public Record Fetch()

The Record object should be «see M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Close» d after use. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance. Win32 MSI API: MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View is not in an active state
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Enumerates over the Records retrieved by the View.

public IEnumerator<WixToolset.Dtf.WindowsInstaller.Record> GetEnumerator()

IEnumerator<WixToolset.Dtf.WindowsInstaller.Record> An enumerator of Record objects.

Each Record object should be «see M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Close» d after use. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance. However, note that it is not necessary to complete the enumeration just for the purpose of closing handles, because Records are fetched lazily on each step of the enumeration. Win32 MSI API: MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionThe View was not d before attempting the enumeration.

Inserts a Record into the view.

public void Insert(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be inserted

Fails if a row with the same primary keys exists. Fails with a read-only database. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe insertion failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Inserts a Record into the View. The inserted data is not persistent.

public void InsertTemporary(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be inserted

Fails if a row with the same primary key exists. Works only with read-write records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe insertion failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Inserts or validates a record.

public bool Merge(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be merged

bool true if the record was inserted or validated, false if there is an existing record with the same primary keys that is not identical

Works only with read-write records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe merge failed (for a reason other than invalid data)
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Updates a fetched Record.

public void Modify(
ViewModifyMode mode,
Record record
)
ParameterTypeDescription
modeViewModifyModespecifies the modify mode
recordRecordthe Record to modify

You can update or delete a record immediately after inserting, or seeking provided you have NOT modified the 0th field of the inserted or sought record. To execute any SQL statement, a View must be created. However, a View that does not create a result set, such as CREATE TABLE, or INSERT INTO, cannot be used with any of the Modify methods to update tables though the view. You cannot fetch a record containing binary data from one database and then use that record to insert the data into another database. To move binary data from one database to another, you should export the data to a file and then import it into the new database using a query and the «see M:WixToolset.Dtf.WindowsInstaller.Record.SetStream(System.Int32,System.String)» . This ensures that each database has its own copy of the binary data. Note that custom actions can only add, modify, or remove temporary rows, columns, or tables from a database. Custom actions cannot modify persistent data in a database, such as data that is a part of the database stored on disk. Win32 MSI API: MsiViewModify

  • M:WixToolset.Dtf.WindowsInstaller.View.Refresh(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Insert(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Update(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Assign(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Replace(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Delete(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.InsertTemporary(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Seek(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Merge(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.Validate(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.ValidateNew(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.ValidateFields(WixToolset.Dtf.WindowsInstaller.Record)
  • M:WixToolset.Dtf.WindowsInstaller.View.ValidateDelete(WixToolset.Dtf.WindowsInstaller.Record)
ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe modification failed,
or a validation was requested and the data did not pass |

| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |

Refreshes the data in a Record.

public void Refresh(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be refreshed

The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Fails with a deleted Record. Works only with read-write Records. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe refresh failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Updates or deletes and inserts a Record into the View.

public void Replace(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be replaced

The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Updates record if the primary keys are unchanged. Deletes old row and inserts new if primary keys have changed. Fails with a read-only database. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe replacement failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations.

public bool Seek(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be filled with the result of the seek

After seeking, the Record may then be used for subsequent Update, Delete, and Refresh operations. All primary key columns of the table must be in the query and the Record must have at least as many fields as the query. Seek cannot be used with multi-table queries. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe seek failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Updates the View with new data from the Record.

public void Update(
Record record
)
ParameterTypeDescription
recordRecordthe new data

Only non-primary keys can be updated. The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Fails with a deleted Record. Works only with read-write Records. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe update failed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Validates a record, returning information about any errors.

public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> Validate(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be validated

System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record was validated; if there is an existing record with the same primary keys that has conflicting data then error information is returned

The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe validation failed (for a reason other than invalid data)
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Validates a record that will be deleted later, returning information about any errors.

public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> ValidateDelete(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be validated

System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record is safe to delete; if another row refers to the primary keys of this row then error information is returned

Validation does not check for the existence of the primary keys of this row in properties or strings. Does not check if a column is a foreign key to multiple tables. Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe validation failed (for a reason other than invalid data)
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Validates fields of a fetched or new record, returning information about any errors. Can validate one or more fields of an incomplete record.

public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> ValidateFields(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be validated

System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record was validated; if there is an existing record with the same primary keys that has conflicting data then error information is returned

Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe validation failed (for a reason other than invalid data)
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Validates a new record, returning information about any errors.

public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> ValidateNew(
Record record
)
ParameterTypeDescription
recordRecordthe Record to be validated

System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record was validated; if there is an existing record with the same primary keys then error information is returned

Checks for duplicate keys. The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe validation failed (for a reason other than invalid data)
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Gets the set of columns that were included in the query for this View, or null if this view is not a SELECT query.

public ColumnCollection Columns { get; set; }

Win32 MSI API: MsiViewGetColumnInfo

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View is not in an active state
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe View handle is invalid

Gets the Database on which this View was opened.

public Database Database { get; set; }

Gets the SQL query string used to open this View.

public string QueryString { get; set; }

Gets the set of tables that were included in the SQL query for this View.

public IList<WixToolset.Dtf.WindowsInstaller.TableInfo> Tables { get; set; }