Export (0) Print
Expand All

ListManager.CreateFromSql Method (PIA)

Commerce Server 2002

Use this method to create a list from an SQL query.

Definition

[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Targeting
…
Public Function CreateFromSql(
 listName As String,
 listDesc As String,
 lFlags As Integer,
 userFlags As Integer,
 connStr As String,
 queryStr As String,
 errLimit As Integer,
 bAsync As Integer,
 Optional ByRef pvarOpID As Object
) As Object
[C#]
using Microsoft.CommerceServer.Interop.Targeting;
…
public object CreateFromSql(
 string listName,
 string listDesc,
 int lFlags,
 int userFlags,
 string connStr,
 string queryStr,
 int errLimit,
 int bAsync,
 ref object pvarOpID 
);

Parameters

[Visual Basic .NET]
listName
A String that provides the name for the list.
listDesc
A String that provides a description for the list.
lFlags
An Integer that specifies the bitmask flags that control the type of list created.
userFlags
An Integer that contains application-specific user flags. Not used by the ListManager object.
connStr
A String that contains the connection string for the SQL Server database.
queryStr
A String that contains the SQL query for retrieving the contents of the new list.
errLimit
An Integer that is not used.
bAsync
An Integer that specifies whether the creation operation is performed synchronously or asynchronously. A value of 1 indicates asynchronous processing.
pvarOpID
An optional Object used to return an Operation ID.
[C#]
listName
A string that provides the name for the list.
listDesc
A string that provides a description for the list.
lFlags
An int that specifies the bitmask flags that control the type of list created.
userFlags
An int that contains application-specific user flags. Not used by the ListManager object.
connStr
A string that contains the connection string for the SQL Server database.
queryStr
A string that contains the SQL query for retrieving the contents of the new list.
errLimit
An int that is not used.
bAsync
An int that specifies whether the creation operation is performed synchronously or asynchronously. A value of 1 indicates asynchronous processing.
pvarOpID
A reference to an object used to return an Operation ID.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns an Object that contains the ID of the new list.

[C#] This method returns a reference to an object used to return the ID of the new list.

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.

ValueDescription
&H8C400001Failed to establish database connection.
&H8C400005Invalid flags value.
&H8C400007The specified list has already been created.
&H8C40000DThe list is designated as a Mailable list but does not contain an rcp_email column.
&H8C40000BThe operation was canceled.
&H8C400003Error while executing SQL/ADO operation.
&H8C40000EThe list is designated as a User list but does not contain an rcp_guid column.
&H80040007The ListManager object has not been properly initialized.
[C#]

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

ValueDescription
0x8C400001Failed to establish database connection.
0x8C400005Invalid flags value.
0x8C400007The specified list has already been created.
0x8C40000DThe list is designated as a Mailable list but does not contain an rcp_email column.
0x8C40000BThe operation was canceled.
0x8C400003Error while executing SQL/ADO operation.
0x8C40000EThe list is designated as a User list but does not contain an rcp_guid column.
0x80040007The 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.

For a list of possible values for the lflags parameter, see the GetListFlags method.

[Visual Basic .NET]

Example

' oListID is an Object
oListID = oListManager.CreateFromSql("LegalTequillaBuyers", _
 "Tequilla buyers at least 21", 20, 0, "Provider=sqloledb;" & _
 "Data Source=TequillaServer;Initial Catalog=Margaritas;" & _
 "Integrated Security='SSPI'", "SELECT * FROM dbname.dbo.Tequilla " & _
 "WHERE Age >= 21", 10, 0)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Targeting

Platforms: Windows 2000, Windows Server 2003

Assembly: listmanagerlib (in listmanagerlib.dll)

See Also

ListManager Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft