SetValue() 공개 메소드

Sets the value of the field at the given field index in the given row. A new row is added if record is null. A new field is added if fieldIndex is greater than or equal to Fields count.
public SetValue ( RecordsetRecord &record, int fieldIndex, string value ) : void
record RecordsetRecord The record to be updated; may be null.
fieldIndex int The index of the field to be updated.
value string The value.
리턴 void
 public void SetValueWithRecordNotExistiongExpectedAddANewRecordToRecordset()
 {
     var rs = new Recordset { Name = "MyRec" };
     rs.Fields.Add(new RecordsetField { Name = "MyField", Alias = "MyField" });
     rs.SetValue(0, 0, "MyTestData");
     Assert.AreEqual("MyTestData", rs.Records[0][0].Value);
 }
 public void SetValueSecondMethodExpectedAddANewRecordToRecordset()
 {
     var rs = new Recordset { Name = "MyRec" };
     var rsr = rs.NewRecord();
     rs.Records.Add(rsr);
     rs.Fields.Add(new RecordsetField { Name = "MyField", Alias = "MyField" });
     rs.Fields.Add(new RecordsetField { Name = "MyField2", Alias = "MyField2" });
     rs.SetValue(ref rsr, 0, "MyTestData");
     Assert.AreEqual("MyTestData", rs.Records[0][0].Value);
     rs.SetValue(ref rsr, 1, "MyTestData1");
     rs.SetValue(ref rsr, 0, "MyTestData3");
     Assert.AreEqual("MyTestData1", rs.Records[0][1].Value);
     Assert.AreEqual("MyTestData3", rs.Records[0][0].Value);
 }