DataConnector
接続の作成
ADO.NET provider for ServiceNow > 接続の作成

To create a connection to a ServiceNow data source, the ADO.NET Provider can be used through the C1ServiceNowConnection class. This expects to be passed a connection string as an argument, which can be either:

Connection string generation

The following code shows how C1ServiceNowConnectionStringBuilder class can be used to configure the connection string for ServiceNow and consumed by C1ServiceNowConnection class to create a connection to the server. Here, you can query the data.

C#
コードのコピー
//接続文字列を作成します。 

using C1ServiceNowConnectionStringBuilder
connBuilder.Username = @"*******";
connBuilder.Password = @"*******";
connBuilder.OAuthClientId = @"*******";
connBuilder.OAuthClientSecret = @"*******";
connBuilder.OAuthTokenEndpoint = @"http://****/****/****";
connBuilder.Url = @"http://****/****/****";

//接続を作成して設定します。
C1ServiceNowConnection conn = new C1ServiceNowConnection(connBuilder)

Connection string literal

Alternatively, the connection string can be written directly as a string literal like in the code example below. A similar approach can be implemented in other DataConnectors for ADO.NET provider.

C#
コードのコピー
//接続文字列を定義します。
string connectionString = @"Username= *******; Password= *******; Oauth Client Id= *******; 
Oauth Client Secret= *******; Oauth Token Endpoint= http://****/****/****; Url= http://****/****/****";
//接続を作成して設定します。
C1ServiceNowConnection conn = new C1ServiceNowConnection(connectionString);