ListManager.ExportToSql Method (PIA)

Use this method to export a list to the specified table in a Microsoft SQL Server database. This operation can be performed synchronously or asynchronously.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Targeting
…
Public Sub ExportToSql(listID As Object,
 connStr As String,
 resTable As String,
 bOverwrite As Integer,
 lOptions As Integer,
 bAsync As Integer,
 Optional ByRef pvarOpID As Object)

[C#]

using Microsoft.CommerceServer.Interop.Targeting;
…
public void ExportToSql(objectlistID,
 stringconnStr,
 stringresTable,
 intbOverwrite,
 intlOptions,
 intbAsync,
 ref objectpvarOpID);

Parameters

[Visual Basic .NET]

  • listID
    An Object that contains the ID or name of the list to be exported.
  • connStr
    A String that contains the connection string for the SQL Server database.
  • resTable
    A String that contains the name of the table into which the list will be exported.
  • bOverwrite
    An Integer that specifies whether to overwrite the data in the table if the table already exists. A value of 1 indicates that the data should be overwritten. A value of 0 produces an error if the tables already exist.
  • lOptions
    An Integer that specifies the export options, for use by the Direct Mail resource. Other applications should generally pass the value 0. A value of 1 causes special action to be taken. See the Remarks section below.
  • bAsync
    An Integer that specifies whether the creation operation is performed synchronously or asynchronously. A value of 1 indicates asynchronous processing. A value of 0 indicates synchronous processing.
  • pvarOpID
    An optional Object used to return an Operation ID. This Operation ID is used in subsequent processing concerning this operation.

[C#]

  • listID
    An object that contains the ID or name of the list to be exported.
  • connStr
    A string that contains the connection string for the SQL Server database.
  • resTable
    A string that contains the name of the table into which the list will be exported.
  • bOverwrite
    An int that specifies whether to overwrite the data if the table already exists. A value of 1 indicates that the data should be overwritten. A value of 0 produces an error if the tables already exist.
  • lOptions
    An int that specifies the export options for use by the Direct Mail resource. Other applications should generally pass the value 0. A value of 1 causes special action to be taken. See the Remarks section below.
  • bAsync
    An int that specifies whether the creation operation is performed synchronously or asynchronously. A value of 1 indicates asynchronous processing. A value of 0 indicates synchronous processing.
  • pvarOpID
    A reference to an object used to return an Operation ID. This Operation ID is used in subsequent processing concerning this operation.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

[Visual Basic .NET]

The following table shows the custom COM errors that a COMException can wrap.

Value Description
&H8C400001 Failed to establish database connection.
&H8C400008 The specified list is currently busy with another operation.
&H8C40001D The specified list is in a FAILED state and may not be used for the operation.
&H8C400006 The specified list does not exist.
&H8C40000B The operation was canceled.
&H8C400003 Error while executing SQL/ADO operation.
&H8C40000F The specified table cannot be created because it already exists.
&H80040007 The ListManager object has not been properly initialized.

[C#]

The following table shows the custom COM errors that a COMException can wrap.

Value Description
0x8C400001 Failed to establish database connection.
0x8C400008 The specified list is currently busy with another operation.
0x8C40001D The specified list is in a FAILED state and may not be used for the operation.
0x8C400006 The specified list does not exist.
0x8C40000B The operation was canceled.
0x8C400003 Error while executing SQL/ADO operation.
0x8C40000F The specified table cannot be created because it already exists.
0x80040007 The ListManager object has not been properly initialized.

Remarks

This method has been rewritten for Commerce Server 2002 Service Pack 1 to increase accuracy. This change may result in decreased performance due to the rewriting of the method.

The parameter pvarOpID contains valid data only if the export operation is performed asynchronously.

The lOptions parameter specifies whether the exported list is intended for use with Direct Mailer, controlling how it is processed during the export. The following table shows the legal values of the IOptions parameter.

lOptions Value Description
0 Do not do any special processing for Direct Mailer.
1 Export the list for use with Direct Mailer. The list must be a Mailable list or an error is returned. If the list is not a Mailing list, it is converted to one.

[Visual Basic .NET]

Example

oListManager.ExportToSql ("{2B544800-4169-4C49-8713-1B794078B4C9}", _
 "Provider=sqloledb;Data Source=TequillaServer;" & _
 "Initial Catalog=Margaritas;Integrated Security='SSPI'", _
 "Tequila", 0, 0, 0)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Targeting

Platforms: Windows 2000, Windows Server 2003

Assembly: listmanagerlib (in listmanagerlib.dll)

See Also

ListManager Class

ListManager.ExtractMailingList

Copyright © 2005 Microsoft Corporation.
All rights reserved.