指定したテーブルにデータを追加します。
名前空間:
GrapeCity.Forguncy.ServerApi
アセンブリ:
GrapeCity.Forguncy.ServerApi (GrapeCity.Forguncy.ServerApi.dll 内)
構文
C# |
---|
void AddTableData(
string tableName,
Dictionary<string, Object> newValues
) |
Visual Basic (宣言) |
---|
Sub AddTableData ( _
tableName As String, _
newValues As Dictionary(Of String, Object) _
) |
パラメータ
- tableName
- 型: System..::..String
データを追加するテーブル名
- newValues
- 型: System.Collections.Generic..::..Dictionary<(Of <(<'String, Object>)>)>
フィールド名と値のコレクションとして作成した追加データ
例
POSTメソッドによるリクエストの内容を基に、Forguncyテーブルに値を追加するコード例を次に示します。
コードのコピーC#
public class SampleApi : ForguncyApi
{
[Post]
public void AddSampleData()
{
StreamReader reader = new StreamReader(this.Context.Request.Body);
string message = reader.ReadToEnd();
Dictionary<string, object> values = new Dictionary<string, object>();
values.Add("date", DateTime.Now);
values.Add("message", message);
values.Add("ip", Context.Request.RemoteIpAddress);
this.DataAccess.AddTableData("SampleTable1", values);
}
} |
参照