ADO.NET Provider for Salesforce Marketing Cloud Account Engagement

Build 23.0.8839

DataAdapter を使用したクエリ

CData ADO.NET Provider for Salesforce Marketing Cloud Account Engagement では、次の2つのネイティブ.NET インターフェースを使用して、Salesforce Marketing Cloud Account Engagement からデータを取得できます。SalesforcePardotDataAdapter オブジェクトおよびSalesforcePardotDataReader オブジェクト。各オブジェクトは同じタスク(データの取得)を実行しますが、実行方法が異なります。SalesforcePardotDataAdapter オブジェクトはクエリに一致するすべてのデータを取得しますが、SalesforcePardotDataReader オブジェクトは必要に応じてインクリメントしながら一部のデータだけをフェッチします。

SalesforcePardotDataAdapter の使用

アダプターのFill メソッドを使用して、データソースからデータを取得します。空のDataTable インスタンスがFill メソッドへの引数として渡されます。このメソッドが戻ってきたとき、DataTable インスタンスにはクエリされたデータが設定されています。Fill メソッドは、戻る前にデータソースからすべてのデータを取得する必要があるため、SalesforcePardotDataAdapter はSalesforcePardotDataReader よりも時間がかかります。

次の例は、Prospects テーブルのId カラムとEmail カラムを選択します。

C#

string connectionString = "InitiateOAuth=GETANDREFRESH;BusinessUnitID=YourBusinessId;";

using (SalesforcePardotConnection connection = new SalesforcePardotConnection(connectionString)) {
  SalesforcePardotDataAdapter dataAdapter = new SalesforcePardotDataAdapter(
  "SELECT Id, Email FROM Prospects", connection);

  DataTable table = new DataTable();
  dataAdapter.Fill(table);

  Console.WriteLine("Contents of Prospects.");

  foreach (DataRow row in table.Rows) {
    Console.WriteLine("{0}: {1}", row["Id"], row["Email"]);
  }
}

VB.NET

Dim connectionString As String = "InitiateOAuth=GETANDREFRESH;BusinessUnitID=YourBusinessId;"

Using connection As New SalesforcePardotConnection(connectionString)
  Dim dataAdapter As New SalesforcePardotDataAdapter("SELECT Id, Email FROM Prospects", connection)

  Dim table As New DataTable()
  dataAdapter.Fill(table)

  Console.WriteLine("Contents of Prospects.")

  For Each row As DataRow In table.Rows
    Console.WriteLine("{0}: {1}", row("Id"), row("Email"))
  Next
End Using

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839