CData Cmdlets for OFX 2019J - Online Help

SELECT INTO ステートメント

CData Cmdlets for OFX 2019J - Build 19.0.7354

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

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

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

C#

String connectionString = "OFXUser=myUser;OFXPassword=myPassword;FIID=myFIID;";

using (OFXConnection connection = new OFXConnection(connectionString)) {
  OFXCommand cmd = new OFXCommand("SELECT Id, ServiceType INTO [csv://Accounts.txt] FROM [Accounts] WHERE ServiceType = 'CREDITCARD' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "OFXUser=myUser;OFXPassword=myPassword;FIID=myFIID;" 

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

C#

String connectionString = "OFXUser=myUser;OFXPassword=myPassword;FIID=myFIID;";

using (OFXConnection connection = new OFXConnection(connectionString)) {
  OFXCommand cmd = new OFXCommand("SELECT * INTO [Accounts] IN [csv://filename=c:/Accounts.csv;delimiter=tab] FROM [Accounts] WHERE ServiceType = 'CREDITCARD'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "OFXUser=myUser;OFXPassword=myPassword;FIID=myFIID;" 

Using connection As New OFXConnection(connectionString)
  Dim cmd As New OFXCommand("SELECT * INTO [Accounts] IN [csv://filename=c:/Accounts.csv;delimiter=tab] FROM [Accounts] WHERE ServiceType = 'CREDITCARD'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

 
 
Copyright (c) 2020 CData Software, Inc. - All rights reserved.
Build 19.0.7354.0