ADO.NET Provider for FinancialForce

Build 21.0.7929

SELECT INTO ステートメント

SELECT INTO ステートメントを使って、書式付きデータをファイルにエクスポートできます。

SQL クエリを使ったデータのエクスポート

次のクエリは、comma-separated values(CSV)ファイルフォーマットにデータをエクスポートします。

C#

String connectionString = "User=myUser;Password=myPassword;Security Token=myToken;";

using (FinancialForceConnection connection = new FinancialForceConnection(connectionString)) {
  FinancialForceCommand cmd = new FinancialForceCommand("SELECT BillingState, Name INTO [csv://Account.txt] FROM [Account] WHERE Industry = 'Floppy Disks' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "User=myUser;Password=myPassword;Security Token=myToken;" 

Using connection As New FinancialForceConnection(connectionString)
  Dim cmd As New FinancialForceCommand("SELECT BillingState, Name INTO [csv://Account.txt] FROM [Account] WHERE Industry = 'Floppy Disks'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using
URI で他のファイルフォーマットを指定できます。以下の例は、tab-separated values(TSV)にエクスポートします。

C#

String connectionString = "User=myUser;Password=myPassword;Security Token=myToken;";

using (FinancialForceConnection connection = new FinancialForceConnection(connectionString)) {
  FinancialForceCommand cmd = new FinancialForceCommand("SELECT * INTO [Account] IN [csv://filename=c:/Account.csv;delimiter=tab] FROM [Account] WHERE Industry = 'Floppy Disks'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "User=myUser;Password=myPassword;Security Token=myToken;" 

Using connection As New FinancialForceConnection(connectionString)
  Dim cmd As New FinancialForceCommand("SELECT * INTO [Account] IN [csv://filename=c:/Account.csv;delimiter=tab] FROM [Account] WHERE Industry = 'Floppy Disks'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7929