指定した値と合致するレコードを更新します。
名前空間:
GrapeCity.Forguncy.ServerApi
アセンブリ:
GrapeCity.Forguncy.ServerApi (GrapeCity.Forguncy.ServerApi.dll 内)
構文
C# |
---|
void UpdateTableData(
string tableName,
ColumnValuePair primaryKey,
Dictionary<string, Object> updateValues
) |
Visual Basic (宣言) |
---|
Sub UpdateTableData ( _
tableName As String, _
primaryKey As ColumnValuePair, _
updateValues As Dictionary(Of String, Object) _
) |
パラメータ
- tableName
- 型: System..::..String
更新対象のテーブル名
- primaryKey
- 型: GrapeCity.Forguncy.ServerApi..::..ColumnValuePair
対象レコードを指定するためのフィールドの名前と値のペア(一意なフィールドを使用)
- updateValues
- 型: System.Collections.Generic..::..Dictionary<(Of <(<'String, Object>)>)>
フィールド名と値のコレクションとして作成した更新データ
例
POSTメソッドによるリクエストの内容を基に、Forguncyテーブルの特定のレコードを更新するコード例を次に示します。
コードのコピーC#
public class SampleApi : ForguncyApi
{
[Post]
public void UpdateDataSample()
{
StreamReader reader = new StreamReader(this.Context.Request.Body);
string message = reader.ReadToEnd();
UpdateObj updateData = JsonConvert.DeserializeObject<UpdateObj>(message);
var targetRecord = new ColumnValuePair() { ColumnName = "ID", Value = updateData.ID };
this.DataAccess.UpdateTableData("SampleTable1", targetRecord, updateData.UpdateData);
}
} |
参照