# 7. Data Access Interfaces

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Data Access Interfaces
Virtuoso .NET Data Provider
VirtDbType Enumeration VirtuosoCommand Class VirtuosoCommandBuild... VirtuosoConnection Class VirtuosoDataAdapter Class VirtuosoDataReader Class VirtuosoError Class VirtuosoErrorCollect... VirtuosoException Class VirtuosoInfoMessageE... VirtuosoInfoMessageE... VirtuosoParameter Class VirtuosoParameterCol... VirtuosoPermission Class VirtuosoPermissionAt... VirtuosoRowUpdatedEv... VirtuosoRowUpdatedEv... VirtuosoRowUpdatingE... VirtuosoRowUpdatingE... VirtuosoTransaction Class
Interactive SQL Utility
Virtuoso Driver for ODBC
Virtuoso Driver for JDBC
OLE DB Provider for Virtuoso
Virtuoso In-Process Client
Unix Domain Socket Connections

## 7.1. Virtuoso .NET Data Provider

## 7.1. OpenLink.Data.Virtuoso and OpenLink.Data.VirtuosoClient

A .NET Data Provider is a set of classes that provide database access for .NET applications. There are two .NET Data Providers for Virtuoso. Each of the Virtuoso providers reside in their own namespace and assembly. The difference between them is that one relies on the Virtuoso ODBC driver for communcation with the server while another doesn't involve any intermediary unmanaged layers and performs all the communcation with the server using managed code only.

Provider | Namespace | Assembly
--- | --- | ---
ODBC-based | OpenLink.Data.VirtuosoClient | OpenLink.Data.VirtuosoClient.dll
All-managed | OpenLink.Data.Virtuoso | OpenLink.Data.Virtuoso.dll

The ODBC-based provider depends on virtodbc.dll to function properly. Note that it calls the dll directly bypassing the ODBC Driver Manager so when an application uses the ODBC-based provider the ODBC-driver dll should also be in the PATH.

### 7.1.2. VirtDbType Enumeration

Specifies Virtuoso data types.

#### Members

Member name | Description
--- | ---
Binary | BINARY data. This maps to an Array of type Byte.
Char | CHAR data. This maps to String.
Date | DATE data. This maps to DateTime.
DateTime | DATETIME data. This maps to DateTime.
Decimal | This is equal to Numeric.
Double | DOUBLE PRECISION data. This maps to Double.
Float | This is equal to Double.
Integer | INTEGER data. This maps to Int32
LongBinary | LONG BINARY data. This maps to an Array of type Byte.
LongNVarChar | LONG NVARCHAR data. This maps to String.
LongVarChar | LONG VARCHAR data. This maps to String.
NChar | NChar data. This maps to String.
Numeric | NUMERIC data. This maps to Decimal
NVarChar | NVARCHAR data. This maps to String.
Real | REAL data, This maps to Single.
SmallInt | SMALLINT data. This maps to Int16
Time | TIME data. This maps to TimeSpan
TimeStamp | TIMESTAMP data. This maps to an Array of type Byte.
VarBinary | VARBINARY data. This maps to an Array of type Byte.
VarChar | VARCHAR data. This maps to String.

### 7.1.3. VirtuosoCommand Class

Represents an SQL statement or stored procedure to execute against a Virtuoso database. This class cannot be inherited.

Figure: 7.1.3.1. Virtuoso .Net Provider VirtuosoCommand Class

public sealed class VirtuosoCommand Component ICloneable IDbCommand

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

The VirtuosoCommand class provides the following methods for executing commands against a Virtuoso database:

Item | Description
--- | ---
ExecuteReader | Executes commands that return rows.
ExecuteNonQuery | Executes commands such as SQL INSERT, DELETE, UPDATE, and SET statements.
ExecuteScalar | Retrieves a single value (for example, an aggregate value) from a database.

#### VirtuosoCommand Constructor

Initializes a new instance of the VirtuosoCommand class.

#### VirtuosoCommand Constructor ()

Initializes a new instance of the VirtuosoCommand class.

public VirtuosoCommand

#### Remarks

The base constructor initializes all fields to their default values. The following table shows initial property values for an instance of VirtuosoCommand.

Properties | Initial Value
--- | ---
CommandText | empty string ("")
CommandTimeout | 30
CommandType | CommandType.Text
Connection | null

You can change the value for any of these properties through a separate call to the property.

#### VirtuosoCommand Constructor (string)

Initializes a new instance of the VirtuosoCommand class with the text of the query.

public VirtuosoCommand string cmdText

#### Parameters

cmdText: | The text of the query.

#### VirtuosoCommand Constructor (string, VirtuosoConnection)

Initializes a new instance of the VirtuosoCommand class with the text of the query and an VirtuosoConnection object.

public VirtuosoCommand string cmdText VirtuosoConnection connection

#### Parameters

cmdText: | The text of the query.
connection: | A VirtuosoConnection object that represents the connection to a Virtuoso database.

#### VirtuosoCommand Constructor (string, VirtuosoConnection, VirtuosoTransaction)

Initializes a new instance of the VirtuosoCommand class with the text of the query, an VirtuosoConnection object, and the VirtuosoTransaction.

public VirtuosoCommand string cmdText VirtuosoConnection connection VirtuosoTransaction transaction

#### Parameters

cmdText: | The text of the query.
connection: | A VirtuosoConnection object that represents the connection to a Virtuoso database.
transaction: | The VirtuosoTransaction in which the VirtuosoCommand executes.

#### Properties

#### CommandText Property

Gets or sets the SQL statement or stored procedure to execute against the Virtuoso database.

public string CommandText

#### Property Value

The SQL statement or stored procedure to execute. The default value is an empty string ("").

#### Implements

IDbCommand.CommandText

#### Remarks

When the CommandType property is set to StoredProcedure, the CommandText property should be set using standard ODBC stored procedure escape sequences. Setting the CommandText to the name of the stored procedurered does not function as it does for some other .NET data providers.

The Virtuoso .NET Data Provider does not support named parameters for passing parameters to a SQL statement or a stored procedure called by an OleDbCommand when CommandType is set to Text. In this case, the question mark (?) placeholder must be used. For example:

    SELECT * FROM Customers WHERE CustomerID = ?

As a result, the order in which VirtuosoParameter objects are added to the VirtuosoParameterCollection must directly correspond to the position of the question mark placeholder for the parameter.

#### CommandTimeout Property

Gets or sets the wait time before terminating an attempt to execute a command and generating an error.

public int CommandTimeout

#### Property Value

The time (in seconds) to wait for the command to execute. The default is 30 seconds.

#### Implements

IDbCommand.CommandTimeout

#### Remarks

A value of zero (0) specifies no limit to the wait time, rather than no wait time, and therefore should be avoided.

#### CommandType Property

Gets or sets a value indicating how the CommandText property is interpreted.

public CommandType CommandType

#### Property Value

One of the System.Data.CommandType values. The default is Text.

#### Implements

IDbCommand.CommandType

#### Remarks

When the CommandType property is set to StoredProcedure, you should set the CommandText property to the full ODBC call syntax. The command then executes this stored procedure when you call one of the Execute methods (for example, ExecuteReader or ExecuteNonQuery).

The Connection, CommandType and CommandText properties cannot be set if the current connection is performing an execute or fetch operation.

The Virtuoso .NET Data Provider does not support passing named parameters to an SQL statement or to a stored procedure called by a VirtuosoCommand. In either of these cases, use the question mark (?) placeholder. For example:

    SELECT * FROM Customers WHERE CustomerID = ?

The order in which VirtuosoParameter objects are added to the VirtuosoParameterCollection must directly correspond to the position of the question mark placeholder for the parameter.

#### Connection Property

Gets or sets the VirtuosoConnection used by this instance of the VirtuosoCommand.

public VirtuosoConnection Connection

#### Property Value

The connection to a Virtuoso database. The default is a null value.

#### Parameters Property

Gets the VirtuosoParameterCollection.

public VirtuosoParameterCollection Connection

#### Property Value

The parameters of the SQL statement or stored procedure. The default is an empty collection.

#### Remarks

When CommandType is set to Text, the Virtuoso .NET Data Provider does not support passing named parameters to an SQL statement or to a stored procedure called by an VirtuosoCommand. In either of these cases, use the question mark (?) placeholder. For example:

    SELECT * FROM Customers WHERE CustomerID = ?

The order in which VirtuosoParameter objects are added to the VirtuosoParameterCollection must directly correspond to the position of the question mark placeholder for the parameter in the command text.

Note:
If the parameters in the collection do not match the requirements of the query to be executed, an error may result.

#### Transaction Property

Gets or sets the VirtuosoTransaction within which the VirtuosoCommand executes.

public VirtuosoTransaction Transaction

#### Property Value

A VirtuosoTransaction. The default is a null value.

#### Remarks

You cannot set the Transaction property if it is already set to a specific value, and the command is in the process of executing. If you set the transaction property to an VirtuosoTransaction object that is not connected to the same VirtuosoConnection as the VirtuosoCommand object, an exception will be thrown the next time you attempt to execute a statement.

#### UpdatedRowSource Property

Gets or sets how command results are applied to the DataRow when used by the Update method of the DbDataAdapter.

public UpdateRowSource UpdatedRowSource

#### Property Value

One of the System.Data.UpdateRowSource values.

#### Implements

IDbCommand.UpdatedRowSource

#### Methods

#### Cancel Method

Attempts to cancel the execution of an VirtuosoCommand.

public Cancel

#### Implements

IDbCommand.Cancel

#### Remarks

If there is nothing to cancel, nothing happens. However, if there is a command in process, and the attempt to cancel fails, no exception is generated.

#### CreateParameter Method

Creates a new instance of a VirtuosoParameter object.

public VirtuosoParameter CreateParameter

#### Return Value

A VirtuosoParameter object.

#### Remarks

The CreateParameter method is a strongly-typed version of IDbCommand.CreateParameter.

#### ExecuteNonQuery Method

Executes an SQL statement against the Connection and returns the number of rows affected.

public int ExecuteNonQuery

#### Return Value

For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1.

#### Implements

IDbCommand.ExecuteNonQuery

#### Remarks

You can use ExecuteNonQuery to perform catalog operations (for example, querying the structure of a database or creating database objects such as tables); or to change the data in a database, without using a DataSet, by executing UPDATE, INSERT, or DELETE statements.

Although ExecuteNonQuery does not return any rows, any output parameters or return values mapped to parameters are populated with data.

#### ExecuteReader Method

Sends the CommandText to the Connection and builds a VirtuosoDataReader.

#### ExecuteReader Method ()

Sends the CommandText to the Connection and builds a VirtuosoDataReader.

public VirtuosoDataReader ExecuteReader

#### Return Value

A VirtuosoDataReader object.

#### ExecuteReader Method (CommandBehavior)

Sends the CommandText to the Connection and builds a VirtuosoDataReader using one of the CommandBehavior values.

public VirtuosoDataReader ExecuteReader CommandBehavior behavior

#### Parameters

behavior: | One of the System.Data.CommandBehavior values.

#### Return Value

A VirtuosoDataReader object.

#### ExecuteScalar Method

Executes the query, and returns the first column of the first row in the resultset returned by the query. Extra columns or rows are ignored.

public object ExecuteScalar

#### Return Value

The first column of the first row in the resultset.

#### Implements

IDbCommand.ExecuteScalar

#### Remarks

Use the ExecuteScalar method to retrieve a single value (for example, an aggregate value) from a database. This requires less code than using the ExecuteReader method, and then performing the operations necessary to generate the single value using the data returned by a VirtuosoDataReader.

A typical ExecuteScalar query can be formatted as in the following C# example:

    command.CommandText = "select count(*) from foobar";
    int count = (int) command.ExecuteScalar();

#### ICloneable.Clone Method

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

object ICloneable.Clone

#### IDbCommand.CreateParameter Method

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IDbDataParameter IDbCommand.CreateParameter

#### IDbCommand.ExecuteReader Method

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

#### IDbCommand.ExecuteReader Method ()

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IDataReader IDbCommand.ExecuteReader

#### IDbCommand.ExecuteReader Method (CommandBehavior)

This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

IDataReader IDbCommand.ExecuteReader CommandBehavior behavior

#### Prepare Method

Creates a prepared (or compiled) version of the command at the Virtuoso server.

public Prepare

#### Implements

IDbCommand.Prepare

### 7.1.4. VirtuosoCommandBuilder Class

Provides a means of automatically generating single-table commands used to reconcile changes made to a DataSet with the associated Virtuoso database. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- System.ComponentModel.Component
- VirtuosoCommandBuilder

public sealed class VirtuosoCommandBuilder Component

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

The VirtuosoDataAdapter does not automatically generate the SQL statements required to reconcile changes made to a DataSet associated with the data source. However, you can create a VirtuosoCommandBuilder object that generates SQL statements for single-table updates if you set the SelectCommand property of the VirtuosoDataAdapter. Then, the VirtuosoCommandBuilder generates any additional SQL statements that you do not set.

The relationship between a VirtuosoDataAdapter and its corresponding VirtuosoCommandBuilder is always one-to-one. To create this correspondence, you set the DataAdapter property of the VirtuosoCommandBuilder object. This causes the VirtuosoCommandBuilder to register itself as a listener for RowUpdating events on the specified VirtuosoDataAdapter object.

To generate INSERT, UPDATE, or DELETE statements, the VirtuosoCommandBuilder uses the SelectCommand property to retrieve a required set of metadata. If you change the value of SelectCommand after the metadata has been retrieved (for example, after the first update), you then should call the RefreshSchema method to update the metadata.

The VirtuosoCommandBuilder also uses the Connection, CommandTimeout, and Transaction properties referenced by the SelectCommand. The user should call RefreshSchema if any of these properties are modified, or if the value of the SelectCommand property itself is changed. Otherwise the InsertCommand, UpdateCommand, and DeleteCommand properties retain their previous values.

If you call Dispose, the VirtuosoCommandBuilder is disassociated from the VirtuosoDataAdapter, and the generated commands are no longer used.

#### VirtuosoCommandBuilder Constructor

#### VirtuosoCommandBuilder Constructor ()

Initializes a new instance of the VirtuosoCommandBuilder class.

public VirtuosoCommandBuilder

#### VirtuosoCommandBuilder Constructor (VirtuosoDataAdapter)

Initializes a new instance of the VirtuosoCommandBuilder class with the associated VirtuosoDataAdapter object.

public VirtuosoCommandBuilder VirtuosoDataAdapter adapter

#### Parameters

adapter: | A VirtuosoDataAdapter object to associate with this VirtuosoCommandBuilder.

#### Remarks

The VirtuosoCommandBuilder registers itself as a listener for RowUpdating events that are generated by the VirtuosoDataAdapter specified in this property.

#### Properties

#### DataAdapter Property

Gets or sets a VirtuosoDataAdapter object for which SQL statements are automatically generated.

public VirtuosoDataAdapter DataAdapter

#### Property Value

A VirtuosoDataAdapter object.

#### Remarks

The VirtuosoCommandBuilder registers itself as a listener for RowUpdating events that are generated by the VirtuosoDataAdapter specified in this property.

#### QuotePrefix Property

Gets or sets the beginning character or characters to use when working with database objects (for example, tables or columns) whose names contain characters such as spaces.

public string QuotePrefix

#### Property Value

The beginning character or characters to use. The default is an empty string.

#### Remarks

Database objects in Virtuoso servers can contain any valid characters, including spaces, commas, and semicolons. To accommodate this capability, use the QuotePrefix and QuoteSuffix properties to specify delimiters such as a left bracket and a right bracket to encapsulate the object name.

#### QuoteSuffix Property

Gets or sets the ending character or characters to use when working with database objects (for example, tables or columns) whose names contain characters such as spaces.

public string QuotePrefix

#### Property Value

The ending character or characters to use. The default is an empty string.

#### Remarks

Database objects in Virtuoso servers can contain any valid characters, including spaces, commas, and semicolons. To accommodate this capability, use the QuotePrefix and QuoteSuffix properties to specify delimiters such as a left bracket and a right bracket to encapsulate the object name.

#### Methods

#### DeriveParameters Method

Retrieves parameter information from the stored procedure specified in the VirtuosoCommand and populates the Parameters collection of the specified VirtuosoCommand object.

public static DeriveParameters VirtuosoCommand command

#### Parameters

command: | The VirtuosoCommand referencing the stored procedure from which the parameter information is to be derived. The derived parameters are added to the Parameters collection of the VirtuosoCommand.

#### Remarks

DeriveParameters overwrites any existing parameter information for the VirtuosoCommand. DeriveParameters requires an extra call to the data server to obtain the information. If the parameter information is known in advance, it is more efficient to populate the parameters collection by setting the information explicitly.

For more information, see "Using Stored Procedures with a Command" in the Microsoft® .NET Framework SDK documentation.

#### Dispose Method

Releases the unmanaged and, optionally, the managed resources used by the VirtuosoCommandBuilder.

protected override Dispose bool disposing

#### Parameters

disposing: | true to release both managed and unmanaged resources; false to release only unmanaged resources.

#### Remarks

This method is called by the public Dispose method and the Finalize method. Dispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. Finalize invokes Dispose with disposing set to false.

When the disposing parameter is true, the method releases all resources held by any managed objects that this VirtuosoCommand references. It does this by invoking the Dispose() method of each referenced object.

For more information about Dispose and Finalize, see "Cleaning Up Unmanaged Resources," and "Overriding the Finalize Method," in the .NET Framework SDK documentation.

#### GetDeleteCommand Method

Gets the automatically generated VirtuosoCommand object required to perform deletions on the Virtuoso database.

public VirtuosoCommand GetDeleteCommand

#### Return Value

The automatically generated VirtuosoCommand object required to perform deletions.

#### Remarks

You can use the GetDeleteCommand method for informational or troubleshooting purposes because it returns the VirtuosoCommand object to be executed.

You can also use GetDeleteCommand as the basis of a modified command. For example, you might call GetDeleteCommand and modify the CommandTimeout value, and then explicitly set that on the VirtuosoDataAdapter.

After the SQL statement is first generated, you must explicitly call RefreshSchema if you change the statement in any way. Otherwise, the GetDeleteCommand still will be using information from the previous statement, which might not be correct. The SQL statements are first generated when the application calls either Update or GetDeleteCommand.

#### GetInsertCommand Method

Gets the automatically generated VirtuosoCommand object required to perform insertions on the Virtuoso database.

public VirtuosoCommand GetInsertCommand

#### Return Value

The automatically generated VirtuosoCommand object required to perform insertions.

#### Remarks

You can use the GetInsertCommand method for informational or troubleshooting purposes because it returns the VirtuosoCommand object to be executed.

You can also use GetInsertCommand as the basis of a modified command. For example, you might call GetInsertCommand and modify the CommandTimeout value, and then explicitly set that on the VirtuosoDataAdapter.

After the SQL statement is first generated, you must explicitly call RefreshSchema if you change the statement in any way. Otherwise, the GetInsertCommand still will be using information from the previous statement, which might not be correct. The SQL statements are first generated when the application calls either Update or GetInsertCommand.

#### GetUpdateCommand Method

Gets the automatically generated VirtuosoCommand object required to perform updates on the Virtuoso database.

public VirtuosoCommand GetUpdateCommand

#### Return Value

The automatically generated VirtuosoCommand object required to perform updates.

#### Remarks

You can use the GetUpdateCommand method for informational or troubleshooting purposes because it returns the VirtuosoCommand object to be executed.

You can also use GetUpdateCommand as the basis of a modified command. For example, you might call GetUpdateCommand and modify the CommandTimeout value, and then explicitly set that on the VirtuosoDataAdapter.

After the SQL statement is first generated, you must explicitly call RefreshSchema if you change the statement in any way. Otherwise, the GetUpdateCommand still will be using information from the previous statement, which might not be correct. The SQL statements are first generated when the application calls either Update or GetUpdateCommand.

#### RefreshSchema Method

Refreshes the database schema information used to generate INSERT, UPDATE, or DELETE statements.

public RefreshSchema

#### Remarks

You should call RefreshSchema whenever the SelectCommand value of the VirtuosoDataAdapter changes.

### 7.1.5. VirtuosoConnection Class

Represents an open connection to a Virtuoso database. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- System.ComponentModel.Component
- VirtuosoConnection

public sealed class VirtuosoConnection Component ICloneable IDbConnection

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

A VirtuosoConnection object represents a unique session to a Virtuoso database server.

The VirtuosoConnection object uses native resources such as network connection handles. You should always explicitly close any open VirtuosoConnection objects by calling Close or Dispose before the VirtuosoConnection object goes out of scope. Not doing so leaves the freeing of these native resources to garbage collection, which may not free them immediately. This, in turn, may eventually cause the underlying driver to run out of resources or reach a maximum limit, resulting in sporadic failures. For example, you might encounter Maximum Connections-related errors while a number of connections are waiting to be deleted by the garbage collector. Explicitly closing the connections by calling Close or Dispose allows a more efficient use of native resources, enhancing scalability and improving overall application performance.

#### VirtuosoConnection Constructor

Initializes a new instance of the VirtuosoConnection class.

#### VirtuosoConnection Constructor ()

Initializes a new instance of the VirtuosoConnection class.

public VirtuosoConnection

#### Remarks

When a new instance of VirtuosoConnection is created, the read/write properties are set to the following initial values unless they are specifically set using their associated keywords in the ConnectionString property.

Properties | Initial Value
--- | ---
ConnectionString | empty string ("")
ConnectionTimeout | 15
Database | empty string ("")

You can change the value for these properties only by using the ConnectionString property

#### VirtuosoConnection Constructor (string)

Initializes a new instance of the VirtuosoConnection class with the specified connection string.

public VirtuosoConnection string connectionString

#### Parameters

connectionString: | The connection used to open the Virtuoso database.

#### Remarks

When a new instance of VirtuosoConnection is created, the read/write properties are set to the following initial values unless they are specifically set using their associated keywords in the ConnectionString property.

Properties | Initial Value
--- | ---
ConnectionString | connectionString
ConnectionTimeout | 15
Database | empty string ("")

You can change the value for these properties only by using the ConnectionString property

#### Properties

#### ConnectionString Property

Gets or sets the string used to open a Virtuoso database.

public string ConnectionString

#### Property Value

The connection string that includes the source database name, and other parameters needed to establish the initial connection. The default value is an empty string.

#### Implements

IDbConnection.ConnectionString

#### Remarks

The ConnectionString is similar to an OLE DB connection string, but is not identical. Unlike OLE DB or ADO, the connection string that is returned is the same as the user-set ConnectionString minus security information if the Persist Security Info value is set to false (default). The Virtuoso .NET Data Provider does not persist or return the password in a connection string unless you set Persist Security Info to true.

The ConnectionString property can be set only when the connection is closed. Many of the connection string values have corresponding read-only properties. When the connection string is set, all of these properties are updated, except when an error is detected. In this case, none of the properties are updated. VirtuosoConnection properties return only those settings contained in the ConnectionString.

Resetting the ConnectionString on a closed connection resets all connection string values (and related properties) including the password. For example, if you set a connection string that includes "Database=Demo", and then reset the connection string to "Data Source=myserver;User ID=dba;Password=dba", the Database property is no longer set to northwind.

The connection string is parsed immediately after being set. If errors in syntax are found when parsing, a runtime exception, such as ArgumentException, is generated. Other errors can be found only when an attempt is made to Open the connection.

Connection string has the following syntax. Each connection string is a sequence of settings Individual settings are separated by semicolons. Each setting is a pair of name and value delimited by the equal sign. Whitespace is ignored on either side of both names and values. Names are case insensitive. The value part can be quoted by either single or double quote characters or remain unquoted at all. However if it includes a semicolon, single quote, or double quote characters, it must be enclosed in either type of quotes. To embed the same character that is used for enclosing the value the character within the value must be doubled.

The following table lists the valid names for values within the ConnectionString.

Name | Default | Description
--- | --- | ---
Connect Timeout -or- Connection Timeout | 15 | The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.
Connection Lifetime | 0 | When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. Useful in clustered configurations to force load balancing between a running server and a server just brought on-line.
Data Source -or- Server -or- Address -or- Network Address |  | The name or network address of the instance of Virtuoso server to which to connect.
Encrypt | false | Specifies if the connection must be SSL encrypted. Currently encryption only works with an ODBC-based provider.
Enlist | true | When true, the pooler automatically enlists the connection in the creation thread's current transaction context.
Initial Catalog -or- Database |  | The name of the database.
Max Pool Size | 100 | The maximum number of connections allowed in the pool.
Min Pool Size | 0 | The minimum number of connections allowed in the pool.
Password -or- Pwd |  | The password for the Virtuoso account logging on.
Persist Security Info | false | When set to 'false', security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open State. Resetting the connection string resets all connection string values including the password
Pooling | true | When true, the VirtuosoConnection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool.
User ID -or- Uid |  | The Virtuoso login name.

#### ConnectionTimeout Property

Gets or sets the time to wait while trying to establish a connection before terminating the attempt and generating an error.

public int ConnectionTimeout

#### Property Value

The time (in seconds) to wait for a connection to open. The default value is 15 seconds.

#### Implements

IDbConnection.ConnectionTimeout

#### Remarks

A value of 0 indicates no limit, and should be avoided in a ConnectionString because an attempt to connect will wait indefinitely.

#### Database Property

Gets the name of the current database or the database to be used after a connection is opened.

public string Database

#### Property Value

The name of the current database or the name of the database to be used once a connection is open. The default value is an empty string.

#### Implements

IDbConnection.Database

#### Remarks

Initially, the Database property is set in the connection string. The Database property can be updated by using the ChangeDatabase method.

#### State Property

Gets the current state of the connection.

public ConnectionState State

#### Property Value

A bitwise combination of the ConnectionState values. The default is Closed.

#### Remarks

The allowed state changes are:

- From Closed to Open, using the Open method of the connnection object.
- From Open to Closed, using either the Close method or the Dispose method of the connection object.

#### Methods

#### BeginTransaction Method

Begins a database transaction.

#### BeginTransaction Method ()

Begins a database transaction.

public VirtuosoTransaction BeginTransaction

#### Return Value

An object representing the new transaction.

#### Remarks

To commit or roll back the transaction, you must explicitly use the Commit or Rollback methods.

To ensure that the Virtuoso .NET Data Provider transaction management model performs correctly, avoid using other transaction management models, such as those provided by the data source.

#### BeginTransaction Method (IsolationLevel)

Begins a database transaction with the specified isolation level.

public VirtuosoTransaction BeginTransaction IsolationLevel isoLevel

#### Parameters

isoLevel: | The isolation level under which the transaction should run.

#### Return Value

An object representing the new transaction.

#### Remarks

To commit or roll back the transaction, you must explicitly use the Commit or Rollback methods.

To ensure that the Virtuoso .NET Data Provider transaction management model performs correctly, avoid using other transaction management models, such as those provided by the data source.

#### ChangeDatabase Method

Changes the current database for an open VirtuosoConnection.

public ChangeDatabase string database

#### Parameters

database: | The name of the database to use in place of the current database.

#### Implements

IDbConnection.ChangeDatabase

#### Remarks

The value parameter must contain a valid database name, and cannot contain a null value, an empty string (""), or a string with only blank characters.

#### Close Method

Closes the connection to the database. This is the preferred method of closing any open connection.

public Close

#### Implements

IDbConnection.Close

#### Remarks

The Close method rolls back any pending transactions. It then releases the connection to the connection pool, or closes the connection if connection pooling is disabled.

An application can call Close more than one time. No exception is generated.

#### CreateCommand Method

Creates and returns a VirtuosoCommand object associated with the VirtuosoConnection.

public VirtuosoCommand CreateCommand

#### Return Value

A VirtuosoCommand object.

#### EnlistDistributedTransaction Method

Enlists in the specified transaction as a distributed transaction.

public EnlistDistributedTransaction ITransaction transaction

#### Parameters

transaction: | A reference to an existing transaction in which to enlist or null to unenlist.

#### Remarks

You can enlist in an existing distributed transaction using the EnlistDistributedTransaction method if auto-enlistment is disabled. Enlisting in an existing distributed transaction ensures that, if the transaction is committed or rolled back, modifications made by the code at the data source are also committed or rolled back.

#### ICloneable.Clone Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

object ICloneable.Clone

#### IDbConnection.BeginTransaction Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

#### IDbConnection.BeginTransaction Method ()

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

IDbTransaction IDbConnection.BeginTransaction

#### IDbConnection.BeginTransaction Method (IsolationLevel)

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

IDbTransaction IDbConnection.BeginTransaction IsolationLevel isoLevel

#### IDbConnection.CreateCommand Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

IDbCommand IDbConnection.CreateCommand

#### Open Method

Opens a database connection with the property settings specified by the ConnectionString.

public Open

#### Implements

IDbConnection.Open

#### Remarks

The VirtuosoConnection draws an open connection from the connection pool if one is available. Otherwise, it establishes a new connection to an instance of Virtuoso server.

Note:

If the VirtuosoConnection goes out of scope, it is not closed. Therefore, you must explicitly close the connection by calling Close or Dispose.

### 7.1.6. VirtuosoDataAdapter Class

Represents a set of data commands and a connection to a data source that are used to fill the DataSet and update the data source. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- System.ComponentModel.Component
- System.Data.Common.DataAdapter
- System.Data.Common.DbDataAdapter
- VirtuosoDataAdapter

public sealed class VirtuosoDataAdapter DbDataAdapter IDbDataAdapter

#### Thread Safety

Any public static (Shared in Microsoft® Visual Basic®) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

The VirtuosoDataAdapter serves as a bridge between a DataSet and data source for retrieving and saving data. The VirtuosoDataAdapter provides this bridge by using Fill to load data from the data source into the DataSet, and using Update to send changes made in the DataSet back to the data source.

The VirtuosoDataAdapter also includes the SelectCommand, InsertCommand, DeleteCommand, UpdateCommand, and TableMappings properties to facilitate loading and updating of data.

#### VirtuosoDataAdapter Constructor

#### VirtuosoDataAdapter Constructor ()

Initializes a new instance of the VirtuosoDataAdapter class.

public VirtuosoDataAdapter

#### Remarks

When you create an instance of VirtuosoDataAdapter, the following read/write properties are set to their default values, as shown in the table.

Properties | Default Value
--- | ---
MissingMappingAction | MissingMappingAction.Passthrough
MissingSchemaAction | MissingSchemaAction.Add

You can change the value of any of these properties through a separate call to the property.

#### VirtuosoDataAdapter Constructor (VirtuosoCommand)

Initializes a new instance of the VirtuosoDataAdapter class with the specified VirtuosoCommand as the SelectCommand property.

public VirtuosoDataAdapter VirtuosoCommand selectCommand

#### Parameters

selectCommand: | A VirtuosoCommand that is an SQL SELECT statement or stored procedure, and is set as the SelectCommand property of the VirtuosoDataAdapter.

#### Remarks

This implementation of the VirtuosoDataAdapter constructor sets the SelectCommand property to the value specified in the selectCommand parameter.

When you create an instance of VirtuosoDataAdapter, the following read/write properties are set to their default values, as shown in the table.

Properties | Default Value
--- | ---
MissingMappingAction | MissingMappingAction.Passthrough
MissingSchemaAction | MissingSchemaAction.Add

You can change the value of any of these properties through a separate call to the property.

#### VirtuosoDataAdapter Constructor (string, VirtuosoConnection)

Initializes a new instance of the VirtuosoDataAdapter class with an SQL SELECT statement and a VirtuosoConnection.

public VirtuosoDataAdapter string selectCommandText VirtuosoConnection selectConnection

#### Parameters

selectCommandText: | A string that is a SQL SELECT statement or stored procedure to be used by the SelectCommand property of the VirtuosoDataAdapter.
selectConnection: | A VirtuosoConnection that represents the connection.

#### VirtuosoDataAdapter Constructor (string, string)

Initializes a new instance of the VirtuosoDataAdapter class with an SQL SELECT statement and a connection string.

public VirtuosoDataAdapter string selectCommandText string selectConnectionString

#### Parameters

selectCommandText: | A string that is a SQL SELECT statement or stored procedure to be used by the SelectCommand property of the VirtuosoDataAdapter.
selectConnectionString: | The connection string.

#### Properties

#### DeleteCommand

Gets or sets an SQL statement or stored procedure used to delete records in the data source.

public VirtuosoCommand DeleteCommand

#### Property Value

A VirtuosoCommand used during an update operation to delete records in the database that correspond to deleted rows in the DataSet.

#### Remarks

When DeleteCommand is assigned to a previously created VirtuosoCommand, the VirtuosoCommand is not cloned. The DeleteCommand maintains a reference to the previously created VirtuosoCommand object.

#### InsertCommand

Gets or sets an SQL statement or stored procedure used to insert new records in the data source.

public VirtuosoCommand InsertCommand

#### Property Value

A VirtuosoCommand used during an update operation to insert records in the database that correspond to new rows in the DataSet.

#### Remarks

When InsertCommand is assigned to a previously created VirtuosoCommand, the VirtuosoCommand is not cloned. The InsertCommand maintains a reference to the previously created VirtuosoCommand object.

#### SelectCommand

Gets or sets an SQL statement or stored procedure used to select records in the data source.

public VirtuosoCommand SelectCommand

#### Property Value

A VirtuosoCommand used during Fill to select records from the database for placement in the DataSet.

#### Remarks

When SelectCommand is assigned to a previously created VirtuosoCommand, the VirtuosoCommand is not cloned. The SelectCommand maintains a reference to the previously created VirtuosoCommand object.

If the SelectCommand does not return any rows, no tables are added to the DataSet, and no exception is raised.

#### UpdateCommand

Gets or sets an SQL statement or stored procedure used to update records in the data source.

public VirtuosoCommand UpdateCommand

#### Property Value

A VirtuosoCommand used during an update operation to update records in the database that correspond to modified rows in the DataSet.

#### Remarks

When UpdateCommand is assigned to a previously created VirtuosoCommand, the VirtuosoCommand is not cloned. The UpdateCommand maintains a reference to the previously created VirtuosoCommand object.

#### Methods

#### CreateRowUpdatedEvent

This member overrides DbDataAdapter.CreateRowUpdatedEvent.

protected override RowUpdatedEventArgs CreateRowUpdatedEvent DataRow dataRow IDbCommand command StatementType statementType DataTableMapping tableMapping

#### CreateRowUpdatingEvent

This member overrides DbDataAdapter.CreateRowUpdatingEvent.

protected override RowUpdatedEventArgs CreateRowUpdatingEvent DataRow dataRow IDbCommand command StatementType statementType DataTableMapping tableMapping

#### OnRowUpdated

Raises the RowUpdated event.

protected override OnRowUpdated RowUpdatedEventArgs value

#### Parameters

value: | A System.Data.Common.RowUpdatedEventArgs object that contains the event data.

#### Remarks

Raising an event invokes the event handler through a delegate. For an overview, see "Raising an Event" in the Microsoft® .NET Framework SDK documentation.

#### OnRowUpdating

Raises the RowUpdating event.

protected override OnRowUpdating RowUpdatingEventArgs value

#### Parameters

value: | A System.Data.Common.RowUpdatingEventArgs object that contains the event data.

#### Remarks

Raising an event invokes the event handler through a delegate. For an overview, see "Raising an Event" in the Microsoft® .NET Framework SDK documentation.

#### Events

#### RowUpdated

Occurs during an Update operation after a command is executed against the data source.

public event VirtuosoRowUpdatedEventHandler RowUpdated

#### Event Data

The event handler receives an argument of type VirtuosoRowUpdatedEventArgs containing data related to this event. The following VirtuosoRowUpdatedEventArgs properties provide information specific to this event.

Property | Description
--- | ---
Command | Gets the VirtuosoCommand executed when Update is called.
Errors (inherited from RowUpdatedEventArgs) | Gets any errors generated by the .NET data provider when the Command was executed.
RecordsAffected (inherited from RowUpdatedEventArgs) | Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
Row (inherited from RowUpdatedEventArgs) | Gets the DataRow sent through an Update.
StatementType (inherited from RowUpdatedEventArgs) | Gets the type of SQL statement executed.
Status (inherited from RowUpdatedEventArgs) | Gets the UpdateStatus of the Command.
TableMapping (inherited from RowUpdatedEventArgs) | Gets the DataTableMapping sent through an Update.

#### Remarks

When using the Update method, there are two events that occur per data row updated. The order of execution is as follows:

1. The values in the DataRow are moved to the parameter values.
2. The OnRowUpdating event is raised.
3. The command executes.
4. If the UpdateRowSource enumeration is set to FirstReturnedRecord, the first returned result is placed in the DataRow.
5. If there are output parameters, they are placed in the DataRow.
6. The OnRowUpdated event is raised.
7. AcceptChanges is called.

#### RowUpdating

Occurs during an Update operation before a command is executed against the data source.

public event VirtuosoRowUpdatingEventHandler RowUpdating

#### Event Data

The event handler receives an argument of type VirtuosoRowUpdatingEventArgs containing data related to this event. The following VirtuosoRowUpdatingEventArgs properties provide information specific to this event.

Property | Description
--- | ---
Command | Gets or sets the VirtuosoCommand to execute when Update is called.
Errors (inherited from RowUpdatingEventArgs) | Gets any errors generated by the .NET data provider when the Command executes.
Row (inherited from RowUpdatingEventArgs) | Gets the DataRow to send through an Update.
StatementType (inherited from RowUpdatingEventArgs) | Gets the type of SQL statement to execute.
Status (inherited from RowUpdatingEventArgs) | Gets the UpdateStatus of the Command.
TableMapping (inherited from RowUpdatingEventArgs) | Gets the DataTableMapping to send through the Update.

#### Remarks

When using the Update method, there are two events that occur per data row updated. The order of execution is as follows:

1. The values in the DataRow are moved to the parameter values.
2. The OnRowUpdating event is raised.
3. The command executes.
4. If the UpdateRowSource enumeration is set to FirstReturnedRecord, the first returned result is placed in the DataRow.
5. If there are output parameters, they are placed in the DataRow.
6. The OnRowUpdated event is raised.
7. AcceptChanges is called.

### 7.1.7. VirtuosoDataReader Class

Provides a means of reading a forward-only stream of rows from a Virtuoso database. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- VirtuosoDataReader

public sealed class VirtuosoDataReader MarshalByRefObject IDataReader IDataRecord IDisposable IEnumerable

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

To create a VirtuosoDataReader, you must call the ExecuteReader method of the VirtuosoCommand object, rather than directly using a constructor.

Changes made to a resultset by another process or thread while data is being read may be visible to the user of the VirtuosoDataReader. However, the precise behavior is both driver and timing dependent.

IsClosed and RecordsAffected are the only properties that you can call after the VirtuosoDataReader is closed. In some cases, you must call Close before you can call RecordsAffected.

#### Properties

#### Depth Property

Gets a value indicating the depth of nesting for the current row.

public int Depth

#### Property Value

The depth of nesting for the current row.

#### Implements

IDataReader.Depth

#### Remarks

The outermost table has a depth of zero. The Virtuoso .NET Data Provider does not support nesting and always returns zero.

#### FieldCount Property

Gets the number of columns in the current row.

public int FieldCount

#### Property Value

When not positioned in a valid record set, 0; otherwise the number of columns in the current record. The default is -1.

#### Implements

IDataRecord.FieldCount

#### Remarks

After executing a query that does not return rows, FieldCount returns 0.

#### IsClosed Property

Gets a value indicating whether the data reader is closed.

public bool IsClosed

#### Property Value

true if the VirtuosoDataReader is closed; otherwise, false.

#### Implements

IDataReader.IsClosed

#### Remarks

IsClosed and RecordsAffected are the only properties that you can call after the VirtuosoDataReader is closed.

#### Item Property

#### Item Property (int)

Gets the value of the specified column in its native format given the column ordinal.

public object this[int i]

#### Parameters

i: | The zero-based column ordinal.

#### Property Value

The value of the specified column in its native format.

#### Implements

IDataRecord.Item

#### Item Property (string)

Gets the value of the specified column in its native format given the column name.

public object this[string name]

#### Parameters

name: | The column name.

#### Property Value

The value of the specified column in its native format.

#### Implements

IDataRecord.Item

#### RecordsAffected Property

Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

public int RecordsAffected

#### Property Value

The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements.

#### Implements

IDataReader.RecordsAffected

#### Remarks

IsClosed and RecordsAffected are the only properties that you can call after the VirtuosoDataReader is closed.

#### Methods

#### Close Method

Closes the VirtuosoDataReader object.

public Close

#### Implements

IDataReader.Close

#### Remarks

You must explicitly call the Close method when you are through using the VirtuosoDataReader to use the associated VirtuosoConnection for any other purpose.

The Close method fills in the values for output parameters, return values and RecordsAffected.

#### GetBoolean Method

Gets the value of the specified column as a Boolean.

public bool GetBoolean int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

A Boolean that is the value of the column.

#### Implements

IDataRecord.GetBoolean

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetByte Method

public byte GetByte int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a byte.

#### Implements

IDataRecord.GetByte

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetBytes Method

Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.

public long GetBytes int i long fieldOffset byte[] buffer int bufferOffset int length

#### Parameters

i: | The zero-based column ordinal.
fieldOffset: | The index within the field from which to begin the read operation.
buffer: | The buffer into which to read the stream of bytes.
bufferOffset: | The index for buffer to begin the read operation.
length: | The number of bytes to read.

#### Return Value

The actual number of bytes read.

#### Implements

IDataRecord.GetBytes

#### Remarks

GetBytes returns the number of available bytes in the field. In most cases this is the exact length of the field. However, the number returned may be less than the true length of the field if GetBytes has already been used to obtain bytes from the field. This may be the case, for example, if the VirtuosoDataReader is reading a large data structure into a buffer. For more information, see the SequentialAccess setting of System.Data.CommandBehavior in the Microsoft® .NET Framework SDK documentation.

If you pass a buffer that is a null value, GetBytes returns the length of the field in bytes.

#### GetChar Method

public char GetChar int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a character.

#### Implements

IDataRecord.GetChar

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetChars Method

Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.

public long GetChars int i long fieldOffset char[] buffer int bufferOffset int length

#### Parameters

i: | The zero-based column ordinal.
fieldOffset: | The index within the field from which to begin the read operation.
buffer: | The buffer into which to copy data..
bufferOffset: | The index for buffer to begin the read operation.
length: | The number of characters to read.

#### Return Value

The actual number of characters read.

#### Implements

IDataRecord.GetChars

#### Remarks

GetChars returns the number of available characters in the field. In most cases this is the exact length of the field. However, the number returned may be less than the true length of the field if GetChars has already been used to obtain characters from the field. This may be the case, for example, if the VirtuosoDataReader is reading a large data structure into a buffer. For more information, see the SequentialAccess setting of System.Data.CommandBehavior in the Microsoft® .NET Framework SDK documentation.

If you pass a buffer that is a null value. GetChars returns the length of the field in characters.

#### GetData Method

Not currently supported.

public IDataReader GetData int i

#### Implements

IDataRecord.GetData

#### GetDataTypeName Method

Gets the name of the source data type.

public string GetDataTypeName int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The name of the source data type.

#### Implements

IDataRecord.GetDataTypeName

#### GetDateTime Method

Gets the value of the specified column as a DateTime object.

public DateTime GetDateTime int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a DateTime object.

#### Implements

IDataRecord.GetDateTime

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetDecimal Method

Gets the value of the specified column as a Decimal object.

public decimal GetDecimal int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a Decimal object.

#### Implements

IDataRecord.GetDecimal

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetDouble Method

public double GetDouble int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a double-precision floating point number.

#### Implements

IDataRecord.GetDouble

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetFieldType Method

Gets the Type that is the data type of the object.

public Type GetFieldType int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The Type that is the data type of the object.

#### Implements

IDataRecord.GetFieldType

#### GetFloat Method

public float GetFloat int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a single-precision floating-point number.

#### Implements

IDataRecord.GetFloat

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetGuid Method

Gets the value of the specified column as a globally-unique identifier (GUID).

public Guid GetGuid int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a GUID.

#### Implements

IDataRecord.GetGuid

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetInt16 Method

Gets the value of the specified column as a 16-bit signed integer.

public short GetInt16 int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a 16-bit signed integer.

#### Implements

IDataRecord.GetInt16

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetInt32 Method

Gets the value of the specified column as a 32-bit signed integer

public int GetInt32 int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a 32-bit signed integer.

#### Implements

IDataRecord.GetInt32

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetInt64 Method

Gets the value of the specified column as a 64-bit signed integer.

public long GetInt64 int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a 64-bit signed integer.

#### Implements

IDataRecord.GetInt64

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetName Method

Gets the name of the specified column.

public string GetName int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

A string that is the name of the specified column.

#### Implements

IDataRecord.GetName

#### GetOrdinal Method

Gets the column ordinal, given the name of the column.

public int GetOrdinal string name

#### Parameters

name: | The name of the column.

#### Return Value

The zero-based column ordinal.

#### Implements

IDataRecord.GetOrdinal

#### GetSchemaTable Method

Returns a DataTable that describes the column metadata of the VirtuosoDataReader.

public DataTable GetSchemaTable

#### Return Value

A DataTable that describes the column metadata.

#### Implements

IDataReader.GetSchemaTable

#### Remarks

For the GetSchemaTable method returns metadata about each column in the following order:

DataReader Column | Description
--- | ---
ColumnName | The name of the column; this might not be unique. If the column name cannot be determined, a null value is returned. This name always reflects the most recent naming of the column in the current view or command text.
ColumnOrdinal | The ordinal of the column. This is zero for the bookmark column of the row, if any. Other columns are numbered starting with one. This column cannot contain a null value.
ColumnSize | The maximum possible length of a value in the column. For columns that use a fixed-length data type, this is the size of the data type.
NumericPrecision | If ProviderType is a numeric data type, this is the maximum precision of the column. The precision depends on the definition of the column. If ProviderType is not a numeric data type, this is a null value.
NumericScale | If ProviderType is decimal, the number of digits to the right of the decimal point. Otherwise, this is a null value.
DataType | Maps to the .Net Framework type of the column.
ProviderType | The indicator of the column's data type. If the data type of the column varies from row to row, this must be Object. This column cannot contain a null value.
IsLong | Set if the column contains a Binary Long Object (BLOB) that contains very long data.
AllowDBNull | Set if the consumer can set the column to a null value or if the provider cannot determine whether or not the consumer can set the column to a null value. Otherwise, not set. A column may contain null values, even if it cannot be set to a null value.
IsReadOnly | true if the column can be modified; otherwise false.
IsRowVersion |
IsUnique | true: No two rows in the base table-the table returned in BaseTableName-can have the same value in this column. IsUnique is guaranteed to be true if the column constitutes a key by itself or if there is a constraint of type UNIQUE that applies only to this column. false: The column can contain duplicate values in the base table. The default of this column is false.
IsKey | true: The column is one of a set of columns in the rowset that, taken together, uniquely identify the row. The set of columns with IsKey set to true must uniquely identify a row in the rowset. There is no requirement that this set of columns is a minimal set of columns. This set of columns may be generated from a base table primary key, a unique constraint or a unique index. false: The column is not required to uniquely identify the row.
IsAutoIncrement | true: The column assigns values to new rows in fixed increments. false: The column does not assign values to new rows in fixed increments. The default of this column is false.
BaseSchemaName | The name of the schema in the data store that contains the column. A null value if the base schema name cannot be determined. The default of this column is a null value.
BaseCatalogName | The name of the catalog in the data store that contains the column. NULL if the base catalog name cannot be determined. The default of this column is a null value.
BaseTableName | The name of the table or view in the data store that contains the column. A null value if the base table name cannot be determined. The default of this column is a null value.
BaseColumnName | The name of the column in the data store. This might be different than the column name returned in the ColumnName column if an alias was used. A null value if the base column name cannot be determined or if the rowset column is derived, but not identical to, a column in the data store. The default of this column is a null value.

#### GetString Method

Gets the value of the specified column as a string.

public string GetString int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value of the specified column as a string.

#### Implements

IDataRecord.GetString

#### Remarks

Call IsDBNull to check for null values before calling this method.

#### GetValue Method

Gets the value of the column at the specified ordinal in its native format.

public object GetValue int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

The value to return.

#### Implements

IDataRecord.GetValue

#### Remarks

This method returns DBNull for null database columns.

#### GetValues Method

Gets all the attribute columns in the current row.

public int GetValues object[] values

#### Parameters

values: | An array of type Object into which to copy the attribute columns.

#### Return Value

The number of instances of Object in the array.

#### Implements

IDataRecord.GetValues

#### Remarks

For most applications, the GetValues method provides an efficient means for retrieving all columns, rather than retrieving each column individually.

You can pass an Object array that contains fewer than the number of columns contained in the resulting row. Only the amount of data the Object array holds is copied to the array. You can also pass an Object array whose length is more than the number of columns contained in the resulting row.

This method returns DBNull for null database columns.

#### IDisposable.Dispose Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

IDisposable.Dispose

#### IEnumerable.GetEnumerator Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

IEnumerable IEnumerable.GetEnumerator

#### IsDBNull Method

Gets a value indicating whether the column contains non-existent or missing values.

public bool IsDBNull int i

#### Parameters

i: | The zero-based column ordinal.

#### Return Value

true if the specified column value is equivalent to DBNull; otherwise, false.

#### Implements

IDataRecord.IsDBNull

#### Remarks

To avoid raising an error, call this method to check for null column values before calling the typed Get methods (for example, GetByte, GetChar, and so on).

#### NextResult Method

Advances the VirtuosoDataReader to the next result, when reading the results of batch SQL statements.

public bool NextResult

#### Return Value

true if there are more result sets; otherwise, false.

#### Implements

IDataReader.NextResult

#### Remarks

Used to process multiple results, which can be generated by executing batch SQL statements.

By default, the VirtuosoDataReader is positioned on the first result.

#### Read Method

Advances the VirtuosoDataReader to the next record.

public bool Read

#### Return Value

true if there are more rows; otherwise, false.

#### Implements

IDataReader.Read

#### Remarks

The default position of the VirtuosoDataReader is prior to the first record. Therefore, you must call Read to begin accessing any data.

### 7.1.8. VirtuosoError Class

Collects information relevant to a warning or error returned by Virtuoso server. This class cannot be inherited.

- System.Object
- VirtuosoError

public sealed class VirtuosoError

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

This class is created by the Virtuoso .NET Data Provider when an error occurs. An instance of VirtuosoError is created and managed by the VirtuosoErrorCollection, which in turn is created by the VirtuosoException class.

#### Properties

#### Message

Gets a short description of the error.

public string Message

#### Property Value

A description of the error.

#### SQLState

Gets the five-character error code that follows the ANSI SQL standard for the database.

public string SQLState

#### Property Value

The five-character error code, which identifies the source of the error.

### 7.1.9. VirtuosoErrorCollection Class

Collects all errors generated by the Virtuoso .NET Data Provider. This class cannot be inherited.

- System.Object
- VirtuosoErrorCollection

public sealed class VirtuosoErrorCollection ICollection

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

This class is created by VirtuosoException to collect instances of the VirtuosoError class. VirtuosoErrorCollection always contains at least one instance of the VirtuosoError class.

#### Properties

#### Count Property

Gets the number of errors in the collection.

public int Count

#### Property Value

The total number of errors in the collection.

#### Implements

ICollection.Count

#### Item Property

Gets the error at the specified index.

public VirtuosoError this[int i]

#### Parameters

i: | The zero-based index of the error to retrieve.

#### Property Value

A VirtuosoError that contains the error at the specified index.

#### Methods

#### CopyTo Method

Copies the elements of the VirtuosoErrorCollection into an array, starting at the given index within the array.

public CopyTo Array array int i

#### Parameters

array: | The array into which to copy the elements.
i: | The starting index of array.

#### Implements

ICollection.CopyTo

#### GetEnumerator Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

IEnumerable IEnumerable.GetEnumerator

### 7.1.10. VirtuosoException Class

The exception that is thrown when Virtuoso server returns a warning or error. This class cannot be inherited.

- System.Object
- System.Exception
- System.SystemException
- VirtuosoException

public sealed class VirtuosoException SystemException

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

This class is created whenever the Virtuoso .NET Data Provider encounters an error generated by the server (Client-side errors are raised as standard common language runtime exceptions.). It always contains at least one instance of VirtuosoError.

#### Properties

#### Errors Property

Gets a collection of one or more VirtuosoError objects that give detailed information about exceptions generated by the Virtuoso .NET Data Provider.

public VirtuosoErrorCollection Errors

#### Property Value

The collected instances of the VitruosoError class.

#### Remarks

This property is a wrapper for the VirtuosoErrorCollection.

#### Message Property

Gets the text describing the error.

public string Message

#### Property Value

The text describing the error.

#### Remarks

This is a wrapper for the Message property of the first VirtuosoError in the Errors property.

### 7.1.11. VirtuosoInfoMessageEventArgs Class

Provides data for the InfoMessage event. This class cannot be inherited.

- System.Object
- System.EventArgs
- VirtuosoInfoMessageEventArgs

public sealed class VirtuosoInfoMessageEventArgs EventArgs

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

The InfoMessage event contains a VirtuosoErrorCollection collection with warnings sent from the Virtuoso srver.

#### Properties

#### Errors Property

Gets the collection of warnings sent from the Virtuoso server.

public VirtuosoErrorCollection Errors

#### Property Value

The collection of warnings sent from the server.

### 7.1.12. VirtuosoInfoMessageEventHandler Delegate

Represents the method that will handle the InfoMessage event of a VirtuosoConnection.

public delegate VirtuosoInfoMessageEventHandler object sender VirtuosoInfoMessageEventArgs e

#### Parameters

The declaration of your event handler must have the same parameters as the VirtuosoInfoMessageEventHandler delegate declaration.

sender: | The source of the event.
e: | A VirtuosoInfoMessageEventArgs object that contains the event data.

#### Remarks

When you create a VirtuosoInfoMessageEventArgs delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see "Events and Delegates" in the .NET Framework SDK documentation.

### 7.1.13. VirtuosoParameter Class

Represents a parameter to an VirtuosoCommand and optionally, its mapping to a DataColumn. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- VirtuosoParameter

public sealed class VirtuosoParameter MarshalByRefObject IDbDataParameter IDataParameter ICloneable

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### VirtuosoParameter Constructor

#### VirtuosoParameter Constructor ()

Initializes a new instance of the VirtuosoParameter class.

public VirtuosoParameter

#### VirtuosoParameter Constructor (string, object)

Initializes a new instance of the VirtuosoParameter class with the parameter name and value.

public VirtuosoParameter string parameterName object object

#### Parameters

parameterName: | The name of the parameter to map.
value: | An Object that is the value of the VirtuosoParameter.

#### Remarks

When you specify an Object in the value parameter, the VirtDbType is inferred from the .NET Framework type of the Object.

#### VirtuosoParameter Constructor (string, VirtDbType)

Initializes a new instance of the VirtuosoParameter class with the parameter name and the data type.

public VirtuosoParameter string parameterName VirtDbType dbType

#### Parameters

parameterName: | The name of the parameter to map.
dbType: | One of the VirtDbType values.

#### Remarks

The data type, and if appropriate, Size and Precision are inferred from the value of the dbType parameter.

#### VirtuosoParameter Constructor (string, VirtDbType, int)

Initializes a new instance of the VirtuosoParameter class with the parameter name, the VirtDbType, and the size.

public VirtuosoParameter string parameterName VirtDbType dbType int size

#### Parameters

parameterName: | The name of the parameter to map.
dbType: | One of the VirtDbType values.
size: | The width of the parameter.

#### Remarks

The Size is inferred from the value of the dbType parameter if it is not explicity set in the size parameter.

#### VirtuosoParameter Constructor (string, VirtDbType, int, string)

Initializes a new instance of the VirtuosoParameter class with the parameter name, VirtDbType, size, and source column name.

public VirtuosoParameter string parameterName VirtDbType dbType int size string sourceColumn

#### Parameters

parameterName: | The name of the parameter to map.
dbType: | One of the VirtDbType values.
size: | The width of the parameter.
sourceColumn: | The name of the source column.

#### Remarks

The Size is inferred from the value of the dbType parameter if it is not explicity set in the size parameter.

#### VirtuosoParameter Constructor (string, VirtDbType, int, ParameterDirection, Boolean, Byte, Byte, String, DataRowVersion, Object)

Initializes a new instance of the VirtuosoParameter class with the parameter name, the type of the parameter, the size of the parameter, a ParameterDirection, the precision of the parameter, the scale of the parameter, the source column, a DataRowVersion to use, and the value of the parameter.

public VirtuosoParameter string parameterName VirtDbType dbType int size ParameterDirection direction bool isNullable byte precision byte scale string sourceColumn DataRowVersion sourceVersion object value

#### Parameters

parameterName: | The name of the parameter to map.
dbType: | One of the VirtDbType values.
size: | The width of the parameter.
direction: | One of the System.Data.ParameterDirection values.
isNullable: | true if the value of the field can be null, otherwise false.
precision: | The total number of digits to the left and right of the decimal point to which Value is resolved.
scale: | The total number of decimal places to which Value is resolved.
sourceColumn: | The name of the source column.
sourceVersion: | One of the System.Data.DataRowVersion values.
value: | An Object that is the value of the VirtuosoParameter.

#### Remarks

The Size and Precision are inferred from the value of the dbType parameter if they are not explicity set in the size and precision parameters.

#### Properties

#### DbType Property

Gets or sets the DbType of the parameter.

public DbType DbType

#### Property Value

One of the System.Data.DbType values. The default is String.

#### Implements

IDataParameter.DbType

#### Remarks

The VirtDbType and DbType are linked. Therefore, setting the DbType changes the VirtDbType to a supporting VirtDbType.

For a list of the supported data types, see the appropriate VirtDbType member.

#### Direction Property

Gets or sets a value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter.

public ParameterDirection Direction

#### Property Value

One of the System.Data.ParameterDirection values. The default is Input.

#### Implements

IDataParameter.Direction

#### Remarks

If the ParameterDirection is Output, and execution of the associated VirtuosoCommand does not return a value, the VirtuosoParameter will contain a null value. Null values are handled using the DBNull class. After the last row from the last resultset is read, the Output, InputOut, and ReturnValue parameters are updated.

#### IsNullable Property

Gets or sets a value indicating whether the parameter accepts null values.

public bool IsNullable

#### Property Value

true if null values are accepted; otherwise, false. The default is false.

#### Implements

IDataParameter.IsNullable

#### Remarks

Null values are handled using the System.DBNull class.

#### ParameterName Property

Gets or sets the name of the VirtuosoParameter.

public string ParameterName

#### Property Value

The name of the VirtuosoParameter. The default is an empty string ("").

#### Implements

IDataParameter.ParameterName

#### Remarks

Instead of named parameters, the Virtuoso .NET Data Provider uses positional parameters that are marked with a question mark (?) in the syntax of the command text. Parameter objects in the VirtuosoParameterCollection and the actual parameters accepted by the stored procedure or parameterized SQL statement correspond to each other based on the order in which the VirtuosoParameter objects are inserted into the collection rather than by parameter name. Parameter names can be supplied, but will be ignored during parameter object binding.

#### Precision Property

Gets or sets the maximum number of digits used to represent the Value property.

public byte Precision

#### Property Value

The maximum number of digits used to represent the Value property. The default value is 0.

#### Implements

IDbDataParameter.Precision

#### Remarks

The Precision property is used only for decimal and numeric input parameters.

#### Scale Property

Gets or sets the number of decimal places to which Value is resolved.

public byte Scale

#### Property Value

The number of decimal places to which Value is resolved. The default is 0.

#### Implements

IDbDataParameter.Scale

#### Remarks

The Scale property is used only for decimal and numeric input parameters.

#### Size Property

Gets or sets the maximum size, in bytes, of the data within the column.

public int Size

#### Property Value

The maximum size, in bytes, of the data within the column. The default value is inferred from the parameter value.

#### Implements

IDbDataParameter.Size

#### Remarks

The Size property is used for binary and string types.

For variable-length data types, the Size property describes the maximum amount of data to transmit to the server. For example, for a string value, the Size property could be used to limit the amount of data sent to the server to the first one hundred bytes.

For nonstring data types and ANSI string data, the Size property refers to the number of bytes. For Unicode string data, the Size property refers to the number of characters. The count for strings does not include the terminating character.

If not explicitly set, the value of Size is inferred from the actual size of the specified parameter value.

For fixed-width data types, the value of Size is ignored. It can be retrieved for informational purposes, and returns the maximum amount of bytes the provider uses when transmitting the value of the parameter to the server.

#### SourceColumn Property

Gets or sets the name of the source column mapped to the DataSet and used for loading or returning the Value.

public string SourceColumn

#### Property Value

The name of the source column that will be used to set the value of this parameter. The default is an empty string ("").

#### Implements

IDataParameter.SourceColumn

#### Remarks

When SourceColumn is set to anything other than an empty string, the value of the parameter is retrieved from the column with the SourceColumn name. If Direction is set to Input, the value is taken from the DataSet. If Direction is set to Output, the value is taken from the data source. A Direction of InputOutput is a combination of both.

#### SourceVersion Property

Gets or sets the DataRowVersion to use when loading Value.

public DataRowVersion DataRowVersion

#### Property Value

One of the System.Data.DataRowVersion values. The default is Current.

#### Implements

IDataParameter.SourceVersion

#### Remarks

The SourceVersion is used by UpdateCommand during an Update operation to determine whether the parameter value is set to Current or Original. This allows primary keys to be updated. This property is ignored by InsertCommand and DeleteCommand.

This property is set to the version of the DataRow used by either the Item property (DataRow indexer), or the GetChildRows method of the DataRow object.

#### Value Property

Gets or sets the value of the parameter.

public object Value

#### Property Value

An Object that is the value of the parameter. The default value is null.

#### Implements

IDataParameter.Value

#### Remarks

For input parameters, the value is bound to the VirtuosoCommand that is sent to the server. For output and return-value parameters, the value is set on completion of the VirtuosoCommand and after the VirtuosoDataReader is closed.

When sending a null parameter value to the server, the user must specify DBNull, not null. A null value in the system is an empty object that has no value. DBNull is used to represent null values.

If the application specifies the database type, the bound value is converted to that type when the provider sends the data to the server. The provider attempts to convert any type of value if it supports the IConvertible interface. Conversion errors may result if the specified type is not compatible with the value.

Both the DbType and VirtDbType properties can be inferred by setting Value. If applicable, the size, precision and scale will also be inferred from Value.

The Value property is overwritten by the Update method.

#### VirtDbType Property

Gets or sets the VirtDbType of the parameter.

public VirtDbType VirtDbType

#### Property Value

One of the VirtDbType values. The default is NVarChar.

#### Remarks

The VirtDbType and DbType are linked. Therefore, setting the DbType changes the VirtDbType to a supporting VirtDbType.

For a list of the supported data types, see the appropriate VirtDbType member. For more information, see "Using Parameters with a DataAdapter" in the Microsoft® .NET Framework SDK documentation.

#### Methods

#### ICloneable.Clone Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

object ICloneable.Clone

#### ToString Method

Gets a string containing the ParameterName.

public override string ToString

#### Return Value

A string containing the ParameterName.

### 7.1.14. VirtuosoParameterCollection Class

Represents a collection of parameters relevant to a VirtuosoCommand as well as their respective mappings to columns in a DataSet. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- VirtuosoParameterCollection

public sealed class VirtuosoParameterCollection MarshalByRefObject IDataParameterCollection ICollection IEnumerable IList

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Properties

#### Count Property

Gets the number of VirtuosoParameter objects in the collection.

public int Count

#### Property Value

The number of VirtuosoParameter objects in the collection.

#### Implements

ICollection.Count

#### Item Property

#### Item Property (int)

Gets or sets the VirtuosoParameter at the specified index.

public object this[int i]

#### Parameters

index: | The zero-based index of the parameter to retrieve.

#### Property Value

The VirtuosoParameter at the specified index.

#### Item Property (string)

Gets or sets the VirtuosoParameter with the specified name.

public object this[string parameterName]

#### Parameters

parameterName: | The name of the parameter to retrieve.

#### Property Value

The VirtuosoParameter with the specified name.

#### Methods

#### Add Method

#### Add Method (object)

Adds the specified VirtuosoParameter object to the VirtuosoParameterCollection.

public int Add object value

#### Parameters

value: | The VirtuosoParameter to add to the collection.

#### Return Value

The index in the collection of the new VirtuosolParameter object.

#### Implements

IList.Add

#### Add Method (VirtuosoParameter)

Adds the specified VirtuosoParameter object to the VirtuosoParameterCollection.

public VirtuosoParameter Add VirtuosoParameter value

#### Parameters

value: | The VirtuosoParameter to add to the collection.

#### Return Value

A reference to the new VirtuosoParameter object.

#### Add Method (string, object)

Adds a VirtuosoParameter to the VirtuosoParameterCollection with the specified parameter name and value.

public VirtuosoParameter Add string parameterName object value

#### Parameters

parameterName: | The name of the parameter.
value: | The Value of the VirtuosoParameter to add to the collection.

#### Return Value

The new VirtuosoParameter object.

#### Add Method (string, VirtDbType)

Adds a VirtuosoParameter to the VirtuosoParameterCollection with the specified parameter name and data type.

public VirtuosoParameter Add string parameterName VirtDbType dbType

#### Parameters

parameterName: | The name of the parameter.
value: | One of the VirtDbType values.

#### Return Value

The new VirtuosoParameter object.

#### Add Method (string, VirtDbType, int)

Adds a VirtuosoParameter to the VirtuosoParameterCollection with the specified parameter name, data type, and parameter size.

public VirtuosoParameter Add string parameterName VirtDbType dbType int size

#### Parameters

parameterName: | The name of the parameter.
value: | One of the VirtDbType values.
size: | The size of the parameter (width of the column).

#### Return Value

The new VirtuosoParameter object.

#### Add Method (string, VirtDbType, int, string)

Adds a VirtuosoParameter to the VirtuosoParameterCollection with the specified parameter name, data type, parameter size, and source column name.

public VirtuosoParameter Add string parameterName VirtDbType dbType int size string sourceColumn

#### Parameters

parameterName: | The name of the parameter.
value: | One of the VirtDbType values.
size: | The size of the parameter (width of the column).
sourceColumn: | The name of the source column.

#### Return Value

The new VirtuosoParameter object.

#### Clear Method

Removes all items from the collection.

public Clear

#### Implements

IList.Clear

#### Contains Method

#### Contains Method (object)

Gets a value indicating whether a VirtusoParameter object exists in the collection.

public bool Contains object value

#### Parameters

value: | The value of the VirtuosoParameter object to find.

#### Return Value

true if the collection contains the VirtuosoParameter; otherwise, false.

#### Implements

IList.Contains

#### Contains Method (string)

Gets a value indicating whether a VirtusoParameter object with the specified parameter name exists in the collection.

public bool Contains string parameterName

#### Parameters

parameterName: | The name of the VirtuosoParameter object to find.

#### Return Value

true if the collection contains the VirtuosoParameter; otherwise, false.

#### Implements

IDataParameterCollection.Contains

#### CopyTo Method

Copies VirtuosoParameter objects from the VirtuosoParameterCollection to the specified array.

public CopyTo Array array int index

#### Parameters

array: | The array into which to copy the VirtuosoParameter objects.
index: | The starting index of the array.

#### Implements

ICollection.CopyTo

#### GetEnumerator Method

This member supports the Microsoft® .NET Framework infrastructure and is not intended to be used directly from your code.

public IEnumerator GetEnumerator

#### IndexOf Method

#### IndexOf Method (object)

Gets the location in the collection of a VirtuosoParameter object.

public int IndexOf object value

#### Parameters

value: | The VirtuosoParameter object to find.

#### Return Value

The zero-based location of the VirtuosoParameter in the collection.

#### Implements

IList.IndexOf

#### IndexOf Method (string)

Gets the location in the collection of the VirtuosoParameter object with the specified parameter name.

public int IndexOf string parameterName

#### Parameters

parameterName: | The name of the VirtuosoParameter object to find.

#### Return Value

The zero-based location of the VirtuosoParameter in the collection.

#### Implements

IDataParameterCollection.IndexOf

#### Insert Method

Inserts a VirtuosoParameter into the collection at the specified index.

public Insert int index object value

#### Parameters

index: | The zero-based index where the parameter is to be inserted within the collection.
value: | The VirtuosoParameter to add to the collection.

#### Implements

IList.Insert

#### Remove Method

Removes the specified VirtuosoParameter from the collection.

public Remove object value

#### Parameters

value: | The VirtuosoParameter object to remove from the collection.

#### Implements

IList.Remove

#### RemoveAt Method

#### RemoveAt Method (int)

Removes the VirtuosoParameter at the specified index from the collection.

public RemoveAt int index

#### Parameters

index: | The zero-based index of the parameter to remove.

#### Implements

IList.RemoveAt

#### RemoveAt Method (string)

Removes the VirtuosoParameter with the specified name from the collection.

public RemoveAt string parameterName

#### Parameters

parameterName: | The name of the parameter to remove.

#### Implements

IDataParameterCollection.RemoveAt

### 7.1.15. VirtuosoPermission Class

Provides the capability for the Virtuoso .NET Data Provider to ensure that a user has a security level adequate to access a data source. This class cannot be inherited.

- System.Object
- System.Security.CodeAccessPermission
- VirtuosoPermission

public sealed class VirtuosoPermission CodeAccessPermission IUnrestrictedPermission

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### VirtuosoPermission Constructor

#### VirtuosoPermission Constructor ()

Initializes a new instance of the VirtuosoPermission class.

public VirtuosoPermission

#### VirtuosoPermission Constructor (PermissionState)

Initializes a new instance of the VirtuosoPermission class.

public VirtuosoPermission PermissionState state

#### Parameters

state: | One of the System.Security.Permissions.PermissionState values.

#### Methods

#### Copy Method

Creates and returns an identical copy of the current permission object.

public override IPermission Copy

#### Return Value

A copy of the current permission object.

#### Implements

IPermission.Copy

#### Remarks

A copy of a permission object represents the same access to resources as the original permission object.

#### FromXml Method

Reconstructs a security object with a specified state from an XML encoding.

public override FromXml SecurityElement securityElement

#### Parameters

securityElement: | The XML encoding to use to reconstruct the security object.

#### Implements

ISecurityEncodable.FromXml

#### Intersect Method

Returns a new permission object representing the intersection of the current permission object and the specified permission object.

public override IPermission Intersect IPermission target

#### Parameters

target: | A permission object to intersect with the current permission object. It must be of the same type as the current permission object.

#### Return Value

A new permission object that represents the intersection of the current permission object and the specified permission object. This new permission object is a null reference (Nothing in Visual Basic) if the intersection is empty.

#### Implements

IPermission.Intersect

#### Remarks

The intersection of two permissions is a permission that describes the set of operations they both describe in common. Only a demand that passes both original permissions will pass the intersection.

#### IsSubsetOf Method

Returns a value indicating whether the current permission object is a subset of the specified permission object.

public override bool IsSubsetOf IPermission target

#### Parameters

target: | A permission object that is to be tested for the subset relationship. This object must be of the same type as the current permission object.

#### Return Value

true if the current permission object is a subset of the specified permission object; otherwise false.

#### Implements

IPermission.IsSubsetOf

#### Remarks

The current permission object is a subset of the specified permission object if the current permission object specifies a set of operations that is wholly contained by the specified permission object. For example, a permission that represents access to C:\example.txt is a subset of a permission that represents access to C:\. If this method returns true, the current permission object represents no more access to the protected resource than does the specified permission object.

#### IsUnrestricted Method

Returns a value indicating whether the permission can be represented as unrestricted without any knowledge of the permission semantics.

public bool IsUnrestricted

#### Return Value

true if the VirtuosoPermission instance was created with PermissionState.Unrestricted; otherwise, false.

#### Implements

IUnrestrictedPermission.IsUnrestricted

#### ToXml Method

Creates an XML encoding of the security object and its current state.

public override SecurityElement ToXml

#### Return Value

An XML encoding of the security object, including any state information.

#### Implements

ISecurityEncodable.ToXml

#### Union Method

Creates a permission that is the union of the permission and the specified permission.

public override IPermission Union IPermission target

#### Parameters

target: | A permission to combine with the current permission. It must be of the same type as the current permission.

#### Return Value

A new permission that represents the union of the current permission and the specified permission.

#### Remarks

The result of a call to Union is a permission that represents all the operations represented by both the current permission and the specified permission. Any demand that passes either permission passes their union.

### 7.1.16. VirtuosoPermissionAttribute

Allows security actions for VirtuosoPermission to be applied to code using declarative security. This class cannot be inherited.

- System.Object
- System.Attribute
- System.Security.Permissions.SecurityAttribute
- System.Security.Permissions.CodeAccessSecurityAttribute
- VirtuosoPermissionAttribute

public sealed class VirtuosoPermissionAttribute CodeAccessSecurityAttribute

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### VirtuosoPermissionAttribute Constructor

Initializes a new instance of the VirtuosoPermissionAttribute class.

public VirtuosoPermissionAttribute

#### Parameters

action: | One of the SecurityAction values representing an action that can be performed using declarative security.

#### Methods

#### CreatePermission Method

Returns a VirtuosoPermission object that is configured according to the attribute properties.

public override IPermission CreatePermission

#### Return Value

A VirtuosoPermission object.

### 7.1.17. VirtuosoRowUpdatedEventArgs Class

Provides data for the RowUpdated event. This class cannot be inherited.

- System.Object
- System.EventArgs
- System.Data.Common.RowUpdatedEventArgs
- VirtuosoRowUpdatedEventArgs

public sealed class VirtuosoRowUpdatedEventArgs RowUpdatedEventArgs

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### VirtuosoRowUpdatedEventArgs Constructor

Initializes a new instance of the VirtuosoRowUpdatedEventArgs class.

public VirtuosoRowUpdatedEventArgs DataRow row IDbCommand command StatementType statementType DataTableMapping tableMapping

#### Parameters

row: | The DataRow sent through an Update.
command: | The IDbCommand executed when Update is called.
statementType: | One of the StatementType values that specifies the type of query executed.
tableMapping: | The DataTableMapping sent through an Update.

#### Properties

#### Command Property

Gets the VirtuosoCommand executed when Update is called.

public new VirtuosoCommand Command

#### Property Value

The VirtuosoCommand executed when Update is called.

### 7.1.18. VirtuosoRowUpdatedEventHandler Delegate

Represents the method that will handle the RowUpdated event of a VirtuosoDataAdapter.

public delegate VirtuosoRowUpdatedEventHandler object sender VirtuosoRowUpdatedEventArgs e

#### Parameters

The declaration of your event handler must have the same parameters as the VirtuosoRowUpdatedEventHandler delegate declaration.

sender: | The source of the event.
e: | A VirtuosoRowUpdatedEventArgs object that contains the event data.

#### Remarks

The handler is not required perform any action, and your code should avoid generating exceptions or allowing exceptions to propagate to the calling method. Any exceptions that do reach the caller are ignored. When you create a VirtuosoRowUpdatedEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see "Events and Delegates" in the .NET Framework SDK documentation.

### 7.1.19. VirtuosoRowUpdatingEventArgs Class

Provides data for the RowUpdating event. This class cannot be inherited.

- System.Object
- System.EventArgs
- System.Data.Common.RowUpdatingEventArgs
- VirtuosoRowUpdatingEventArgs

public sealed class VirtuosoRowUpdatingEventArgs RowUpdatingEventArgs

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### VirtuosoRowUpdatingEventArgs Constructor

Initializes a new instance of the VirtuosoRowUpdatingEventArgs class.

public VirtuosoRowUpdatingEventArgs DataRow row IDbCommand command StatementType statementType DataTableMapping tableMapping

#### Parameters

row: | The DataRow sent through an Update.
command: | The IDbCommand executed when Update is called.
statementType: | One of the StatementType values that specifies the type of query executed.
tableMapping: | The DataTableMapping sent through an Update.

#### Properties

#### Command Property

Gets or sets the VirtuosoCommand executed when Update is called.

public new VirtuosoCommand Command

#### Property Value

The VirtuosoCommand executed when Update is called.

### 7.1.20. VirtuosoRowUpdatingEventHandler Delegate

Represents the method that will handle the RowUpdating event of a VirtuosoDataAdapter.

public delegate VirtuosoRowUpdatingEventHandler object sender VirtuosoRowUpdatingEventArgs e

#### Parameters

The declaration of your event handler must have the same parameters as the VirtuosoRowUpdatingEventHandler delegate declaration.

sender: | The source of the event.
e: | A VirtuosoRowUpdatingEventArgs object that contains the event data.

#### Remarks

The handler is not required perform any action, and your code should avoid generating exceptions or allowing exceptions to propagate to the calling method. Any exceptions that do reach the caller are ignored. When you create a VirtuosoRowUpdatingEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event handler delegates, see "Events and Delegates" in the .NET Framework SDK documentation.

### 7.1.21. VirtuosoTransaction Class

Represents a transaction to be made at a Virtuoso database. This class cannot be inherited.

- System.Object
- System.MarshalByRefObject
- VirtuosoTransaction

public sealed class VirtuosoTransaction MarshalByRefObject IDbTransaction IDisposable

#### Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

#### Remarks

The application creates a VirtuosoTransaction object by calling BeginTransaction on the VirtuosoConnection object. All subsequent operations associated with the transaction (for example, committing or aborting the transaction), are performed on the VirtuosoTransaction object.

#### Properties

#### Connection

Gets the VirtuosoConnection object associated with the transaction.

public VirtuosoConnection Connection

#### Property Value

The VirtuosoConnection object to associate with the transaction.

#### Remarks

A single application may have multiple database connections, each with zero or more transactions. This property enables you to determine the connection object associated with a particular transaction.

#### IsolationLevel

Specifies the IsolationLevel for this transaction

public IsolationLevel IsolationLevel

#### Property Value

The IsolationLevel for this transaction.

#### Implements

IDbTransaction.IsolationLevel

#### Remarks

Parallel transactions are not supported. Therefore, the IsolationLevel applies to the entire transaction.

#### Methods

#### Commit Method

Commits the database transaction.

public Commit

#### Dispose Method

Releases the unmanaged resources used by the VirtuosoTransaction and optionally releases the managed resources.

public Dispose

#### Implements

IDisposable.Dispose

#### Rollback Method

Rolls back a transaction from a pending state.

public Rollback

#### Implements

IDbTransaction.Rollback

#### Remarks

The transaction can be rolled back only from a pending state (after BeginTransaction has been called, but before Commit is called).

Previous Contents of Data Access Interfaces | Chapter Contents | Next Interactive SQL Utility