表示行的插入或更新信息。
Inheritance Hierarchy
Aliyun.OpenServices.OpenTableServiceRowChange
Aliyun.OpenServices.OpenTableServiceRowPutChange
Namespace: Aliyun.OpenServices.OpenTableService
Assembly: Aliyun.OpenServices (in Aliyun.OpenServices.dll) Version: 1.0.5290.21916
Syntax
The RowPutChange type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | RowPutChange |
初始化新的RowPutChange实例。
|
![]() | RowPutChange(IDictionaryString, PrimaryKeyValue) |
初始化新的RowPutChange实例。
|
![]() | RowPutChange(IDictionaryString, PrimaryKeyValue, IDictionaryString, ColumnValue) |
初始化新的RowPutChange实例。
|
Methods
Name | Description | |
---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode |
用作特定类型的哈希函数。
(Inherited from Object.) |
![]() | GetType |
获取当前实例的 Type。
(Inherited from Object.) |
![]() | MemberwiseClone |
创建当前 Object 的浅表副本。
(Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
Properties
Name | Description | |
---|---|---|
![]() | AttributeColumns |
获取属性列(Attribute Column)名称与值的对应字典。
|
![]() | CheckingMode |
获取或设置进行数据存在性检查的方式。
|
![]() | PrimaryKeys |
获取主键(Primary Key)列名称与值的对应字典。
(Inherited from RowChange.) |
Examples
using System; using System.Linq; using Aliyun.OpenServices.OpenTableService; namespace Aliyun.OpenServices.Samples.OpenTableService { class PutDataSample { string endpoint = "http://ots.aliyuncs.com"; string accessId = "<your access id>"; string accessKey = "<your access key>"; public void PutData(string tableName) { // 构造RowPutChange var rowChange = new RowPutChange(); // 注意rowChange的主键信息必须与创建表时指定的主键个数、名称及类型均一致 // 可以直接赋值主键为支持的类型对象,包括整型、布尔型和字符串。 rowChange.PrimaryKeys["uid"] = 1; rowChange.PrimaryKeys["flag"] = true; rowChange.PrimaryKeys["name"] = "张三"; //.其他属性信息放在AttributeColumns中,可以是建表时没有指定的列 // 可以直接赋值列值为支持的类型对象,包括整型、浮点型、布尔型和字符串。 rowChange.AttributeColumns["groupid"] = 1; rowChange.AttributeColumns["mobile"] = "11111111111"; rowChange.AttributeColumns["address"] = "中国某地"; rowChange.AttributeColumns["age"] = 20; // 提交数据 var otsClient = new OtsClient(endpoint, accessId, accessKey); try { otsClient.PutData(tableName, rowChange); } catch (OtsException ex) { Console.WriteLine("插入数据失败。OTS异常消息: " + ex.Message); Console.WriteLine("Request ID: {0}\tHostID: {1}", ex.RequestId, ex.HostId); } catch (System.Net.WebException ex) { Console.WriteLine("创建表失败。网络异常:{0}。请检查Endpoint或网络链接。", ex.Message); } } } }
See Also