dotConnect for PostgreSQL Documentation
CommandType Property
See Also  Example support@devart.com
Devart.Data.PostgreSql Namespace > PgSqlCommand Class : CommandType Property

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

Syntax

Visual Basic (Declaration) 
Public Overrides Property CommandType As CommandType
C# 
public override CommandType CommandType {get; set;}

Property Value

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

Remarks

CommandType can be one of the following values: Text, StoredProcedure, TableDirect.

When the value is CommandType.Text, the property CommandText should contain text of a query that must be run on the server.

When the value is CommandType.StoredProcedure, CommandText property must be a name of a procedure to execute.

When the value is set to TableDirect, CommandText must be name of a table you want to get all data from. All rows and columns are retrieved.

dotConnect for PostgreSQL supports named and unnamed parameters. Parameters of stored procedures can be used only as input, output values will be ignored.

Example

The following example creates an instance of a derived class PgSqlCommand and sets some of its properties.
C#csharpCopy Code
public void CreateCommand()
{
  PgSqlCommand pgCommand = new PgSqlCommand();
  pgCommand.CommandText = "SELECT * FROM Test.Dept ORDER BY DeptNo";
  pgCommand.CommandType = CommandType.Text;
}
C#Visual BasicCopy Code
Public Sub CreateCommand()
  Dim pgCommand As New PgSqlCommand()
  pgCommand.CommandText = "SELECT * FROM Test.Dept ORDER BY DeptNo"
  pgCommand.CommandType = CommandType.Text
End Sub

Requirements

Platforms:Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8, Windows 10, Windows Server 2012 family.

See Also