dotConnect Universal Documentation
Devart.Data.Universal Namespace / UniCommand Class / Connection Property
Example

In This Topic
    Connection Property (UniCommand)
    In This Topic
    Gets or sets the UniConnection used by this instance of the UniCommand.
    Syntax
    'Declaration
     
    Public Shadows Property Connection As UniConnection
    public new UniConnection Connection {get; set;}

    Property Value

    The connection to a database. The default value is a null reference.
    Remarks

    UniConnection specified in this property will carry out all operations executed with this UniCommand.

    Example
    The following example creates a UniCommand and sets some of its properties.
    public void CreateCommand()
    {
      string mySelectQuery = "SELECT * FROM Test.Dept ORDER BY DeptNo";
      UniCommand myCommand = new UniCommand(mySelectQuery);
      myCommand.Connection = new UniConnection
        ("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa");
      myCommand.CommandType = System.Data.CommandType.Text;
    }
    Public Sub CreateCommand()
      Dim mySelectQuery As String = _
        "SELECT * FROM Test.Dept ORDER BY DeptNo"
      Dim myCommand As New UniCommand(mySelectQuery)
      myCommand.Connection = New UniConnection _
        ("Provider=SQL Server;Data Source=SERVER;Initial Catalog=Northwind;User ID=sa")
      myCommand.CommandType = System.Data.CommandType.Text
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also