ADO.NET Provider for Zoho Creator

Build 23.0.8839

INSERT ステートメント

新しいレコードを作成するには、INSERT ステートメントを使用します。

INSERT 構文

INSERT ステートメントは、挿入するカラムと新しいカラム値を指定します。複数のカラム値は、次の例に示すように、VALUES 句のカンマ区切りリストで指定できます。

INSERT INTO <table_name> 
( <column_reference> [ , ... ] )
VALUES 
( { <expression> | NULL } [ , ... ] ) 
  

<expression> ::=
  | @ <parameter> 
  | ?
  | <literal>

次の例に示すように、ExecuteNonQuery メソッドを使って、データ操作コマンドを実行し影響を受けた行を取得できます。

C#

String connectionString = "InitiateOAuth=GETANDREFRESH;";
using (ZohoCreatorConnection connection = new ZohoCreatorConnection(connectionString)) {
  int rowsAffected;
  ZohoCreatorCommand cmd = new ZohoCreatorCommand("INSERT INTO [CData].[Employee Management].Leave_Types (Leave_Type) VALUES ('Sick')", connection);
  rowsAffected = cmd.ExecuteNonQuery();
}

VB.NET

Dim connectionString As [String] = "InitiateOAuth=GETANDREFRESH;"
Using connection As New ZohoCreatorConnection(connectionString)
  Dim rowsAffected As Integer
  Dim cmd As New ZohoCreatorCommand("INSERT INTO [CData].[Employee Management].Leave_Types (Leave_Type) VALUES ('Sick')", connection)
  rowsAffected = cmd.ExecuteNonQuery()
End Using

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839