ADO.NET Provider for Confluence

Build 21.0.7930

SELECT INTO ステートメント

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

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

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

C#

String connectionString = "User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net;Timezone=America/New_York;";

using (ConfluenceConnection connection = new ConfluenceConnection(connectionString)) {
  ConfluenceCommand cmd = new ConfluenceCommand("SELECT Key, Name INTO [csv://Pages.txt] FROM [Pages] WHERE Id = '10000' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net;Timezone=America/New_York;" 

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

C#

String connectionString = "User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net;Timezone=America/New_York;";

using (ConfluenceConnection connection = new ConfluenceConnection(connectionString)) {
  ConfluenceCommand cmd = new ConfluenceCommand("SELECT * INTO [Pages] IN [csv://filename=c:/Pages.csv;delimiter=tab] FROM [Pages] WHERE Id = '10000'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net;Timezone=America/New_York;" 

Using connection As New ConfluenceConnection(connectionString)
  Dim cmd As New ConfluenceCommand("SELECT * INTO [Pages] IN [csv://filename=c:/Pages.csv;delimiter=tab] FROM [Pages] WHERE Id = '10000'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

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