PreviousNext
Help > Easycom .NET > Easycom namespace > EasycomFile > EasycomFile.SetValue Method
EasycomFile.SetValue Method

 Defines a field value for modifying or inserting a record.

 

Class EasycomFile

Syntax

public void EasycomFile.SetValue(Integer f, Object Value)

public void EasycomFile.SetValue(String fieldName, Object Value)

 

 

Description

 

This function changes a value for the specified field. This function call is valid only when having the current record locked or when being in append mode.

 

Example 1 (VB.NET):

This example uses the implicit record locking. Lock error may occur when reading the record.

 

Dim my_cnx As EasycomConnection

Dim my_file As EasycomFile

 

my_cnx = New EasycomConnection

my_cnx.ConnectionString = "Server=194.206.160.111;User Id=

my_cnx.Open()

 

my_file = my_cnx.OpenFile("s_customer", openFileAccess.ReadWrite)

my_file.SetFetchMode(fetchMode.Locked)

 

If my_file.ReadKey(1354) Then

my_file.SetValue("STATE", "CA")

my_file.SetValue("CITY", "San Francisco")

my_file.RecordUpdate()

End If

 

Example 2 (VB.NET):

This example uses the explicit record locking. Lock error may occur when locking record, if lock fails or if the record changed between the "read" and the "lock".

 

Dim my_cnx As EasycomConnection

Dim my_file As EasycomFile

 

my_cnx = New EasycomConnection

my_cnx.ConnectionString = "Server=194.206.160.111;User Id=

my_cnx.Open()

 

my_file = my_cnx.OpenFile("s_customer", openFileAccess.ReadWrite)

 

If my_file.ReadKey(1354) Then

my_file.RecordLock()

my_file.SetValue("STATE", "CA")

my_file.SetValue("CITY", "San Francisco")

my_file.RecordUpdate()

End If

 

Example 1 (C#):

This example uses the implicit record locking. Lock error may occur when reading the record.

 

EasycomConnection my_cnx;

EasycomFile my_file;

 

my_cnx = new EasycomConnection();

my_cnx.ConnectionString = "Server=194.206.160.111;User Id=

my_cnx.Open();

 

my_file = my_cnx.OpenFile("s_customer", openFileAccess.ReadWrite);

my_file.SetFetchMode(fetchMode.Locked);

 

if (my_file.ReadKey(1354))

{

my_file.SetValue("STATE", "CA");

my_file.SetValue("CITY", "San Francisco");

my_file.RecordUpdate();

}

 

Example 2 (C#);

This example uses the explicit record locking. Lock error may occur when locking record if lock fails or if the record changed between the "read" and the "lock".

 

EasycomConnection my_cnx;

EasycomFile my_file;

 

my_cnx = new EasycomConnection();

my_cnx.ConnectionString = "Server=194.206.160.111;User Id=

my_cnx.Open();

 

my_file = my_cnx.OpenFile("s_customer", openFileAccess.ReadWrite);

 

if (my_file.ReadKey(1354)) 

{

my_file.RecordLock();

my_file.SetValue("STATE", "CA");

my_file.SetValue("CITY", "San Francisco");

my_file.RecordUpdate();

}