Share via


Propriété QueueDelay

Gets or sets the amount of time in milliseconds that can elapse before audit actions are processed.

Espace de noms :  Microsoft.SqlServer.Management.Smo
Assembly :  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Syntaxe

'Déclaration
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property QueueDelay As Integer
    Get
    Set
'Utilisation
Dim instance As Audit
Dim value As Integer

value = instance.QueueDelay

instance.QueueDelay = value
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public int QueueDelay { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property int QueueDelay {
    int get ();
    void set (int value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member QueueDelay : int with get, set
function get QueueDelay () : int
function set QueueDelay (value : int)

Valeur de propriété

Type : System. . :: . .Int32
A Int32 value that specifies the number of milliseconds that can elapse before audit actions are processed.

Notes

The default value, 1000 (1 second), is the minimum value that can be set. The maximum value that can be set is 2,147,483,647 milliseconds, which is equivalent to 24 days, 20 hours, 31 minutes, 23.647 seconds. The value 0 indicates synchronous delivery.

Exemples

The following code example demonstrates how to set the queue delay to 5000 milliseconds.

C#

using System;
using Microsoft.SqlServer.Management.Smo;

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the audit and set the queue delay
            Server dbServer = new Server("(local)");
            Audit dbAudit = new Audit(dbServer, "Test Audit");
            dbAudit.DestinationType = AuditDestinationType.File;
            dbAudit.FilePath = "C:\\AuditDirectory";
            dbAudit.QueueDelay = 5000;
            dbAudit.Create();
        }
    }
}

Powershell

#Create the audit and set the queue delay
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbAudit = New-Object Microsoft.SqlServer.Management.Smo.Audit($dbServer, "Test Audit")
$dbAudit.DestinationType = [Microsoft.SqlServer.Management.Smo.AuditDestinationType]'File'
$dbAudit.FilePath = "C:\AuditDirectory"
$dbAudit.QueueDelay = 5000
$dbAudit.Create()