IListManager::ExportToSql Method [C++]

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

[C++]

HRESULT IListManager::ExportToSql(VARIANTlistID,
 BSTRconnStr,
 BSTRresTable,
 BOOLbOverwrite,
 longlOptions,
 BOOLbAsync,
 VARIANT*pvarOpID);

[Visual Basic]

Sub ExportToSql(listID As Variant,
 connStr As String,
 resTable As String,
 bOverwrite As Boolean,
 lOptions As Long,
 bAsync As Boolean,
 Optional pvarOpID As Variant)

Parameters

  • listID[C++]
    [in] A VARIANT that contains the ID or name of the list to be exported.
  • listID[Visual Basic]
    A Variant that contains the ID or name of the list to be exported.
  • connStr[C++]
    [in] A BSTR that contains the connection string for the SQL Server database.
  • connStr[Visual Basic]
    A String that contains the connection string for the SQL Server database.
  • resTable [C++]
    [in] A BSTR that contains the name of the table into which the list will be exported.
  • resTable[Visual Basic]
    A String that contains the name of the table into which the list will be exported.
  • bOverwrite[C++]
    [in] A BOOL that specifies whether to overwrite the data if the table already exists. A value of True indicates that the data should be overwritten. A value of False produces an error if the tables already exist.
  • bOverwrite[Visual Basic]
    A Boolean that specifies whether to overwrite the data in the table if the table already exists. A value of True indicates that the data should be overwritten. A value of False produces an error if the tables pre-exists.
  • lOptions[C++]
    [in] A long that specifies the export options for use by the Direct Mail resource. Other applications should generally pass the value zero (0). A value of one (1) causes special action to be taken. See the Remarks section below.
  • lOptions[Visual Basic]
    A Long that specifies the export options, for use by the Direct Mail resource. Other applications should generally pass the value zero (0). A value of one (1) causes special action to be taken. See the Remarks section below.
  • bAsync[C++]
    [in] A BOOL that specifies whether the creation operation is performed synchronously or asynchronously. A value of True indicates asynchronous processing. A value of False indicates synchronous processing.
  • bAsync[Visual Basic]
    A Boolean that specifies whether the creation operation is performed synchronously or asynchronously. A value of True indicates asynchronous processing. A value of False indicates synchronous processing.
  • pvarOpID[C++]
    [out, optional] A pointer to a VARIANT used to return an Operation ID. This Operation ID is used in subsequent processing concerning this operation.
  • pvarOpID[Visual Basic]
    An optional Variant used to return an Operation ID. This Operation ID is used in subsequent processing concerning this operation.

[C++]

Return Values

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_LM_CONNECTIONFAILED [C++] 0x8C400001

[Visual Basic] &H8C400001

Failed to establish database connection.
E_LM_LIST_BUSY [C++] 0x8C400008

[Visual Basic] &H8C400008

The specified list is currently busy with another operation.
E_LM_LIST_IN_FAILED_STATE [C++] 0x8C40001D

[Visual Basic] &H8C40001D

The specified list is in a FAILED state and may not be used for the operation.
E_LM_LIST_NOT_FOUND [C++] 0x8C400006

[Visual Basic] &H8C400006

The specified list does not exist.
E_LM_OPER_CANCELED [C++] 0x8C40000B

[Visual Basic] &H8C40000B

The operation was canceled.
E_LM_SQLERROR [C++] 0x8C400003

[Visual Basic] &H8C400003

Error while executing SQL/ADO operation.
E_LM_TABLE_ALREADY_EXISTS [C++] 0x8C40000F

[Visual Basic] &H8C40000F

The specified table cannot be created because it already exists.
OLE_E_BLANK [C++] 0x80040007

[Visual Basic] &H80040007

The ListManager object has not been properly initialized.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

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.

An existing table is expected to have the same format as the exported list. If the table does not exist, it will be created.

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.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

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

See Also

[C++]ListManager Object

[C++]IListManager::ExtractMailingList

[Visual Basic]ListManager Object

[Visual Basic]ListManager.ExtractMailingList

Copyright © 2005 Microsoft Corporation.
All rights reserved.