ADO.NET Provider for Yahoo Shopping

Build 20.0.7587

SELECT INTO ステートメント

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

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

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

C#

String connectionString = "InitiateOAuth=GETANDREFRESH;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;";

using (YahooShoppingConnection connection = new YahooShoppingConnection(connectionString)) {
  YahooShoppingCommand cmd = new YahooShoppingCommand("SELECT Id, Column1 INTO [csv://SampleTable_1.txt] FROM [SampleTable_1] WHERE Column2 = 'Bob' ", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "InitiateOAuth=GETANDREFRESH;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;" 

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

C#

String connectionString = "InitiateOAuth=GETANDREFRESH;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;";

using (YahooShoppingConnection connection = new YahooShoppingConnection(connectionString)) {
  YahooShoppingCommand cmd = new YahooShoppingCommand("SELECT * INTO [SampleTable_1] IN [csv://filename=c:/SampleTable_1.csv;delimiter=tab] FROM [SampleTable_1] WHERE Column2 = 'Bob'", connection);
  int rowsAffected = cmd.ExecuteNonQuery();
} 

VB.NET

Dim connectionString As [String] = "InitiateOAuth=GETANDREFRESH;OAuthClientId=MyOAuthClientId;OAuthClientSecret=MyOAuthClientSecret;CallbackURL=http://localhost:33333;" 

Using connection As New YahooShoppingConnection(connectionString)
  Dim cmd As New YahooShoppingCommand("SELECT * INTO [SampleTable_1] IN [csv://filename=c:/SampleTable_1.csv;delimiter=tab] FROM [SampleTable_1] WHERE Column2 = 'Bob'", connection)
  Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
End Using

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