Do not use the CUpdate class directly. Use the preallocated WIDatabase.Update variable instead.

Functions to update records in tables.

Namespace: Wiker.WIDatabase
Assembly: 

Syntax

C#
public class CUpdate : CConditionCommon
Visual Basic
Public Class CUpdate _
	Inherits CConditionCommon
Visual C++
public ref class CUpdate : public CConditionCommon

Remarks

If Update fails with a Database locked error message, check that all previous instances of WIDatabase called the Close() function.

Examples

CopyC#
WIDatabase WIDB;
CDatabaseInfo DBInfo;
string Str;

/* Create CDatabaseInfo object and populate with database login info */
DBInfo = new CDatabaseInfo();
DBInfo.DatabaseType = eDatabaseType.SQL;
DBInfo.Location     = "SqlServer";
DBInfo.DBName       = "TestDatabase";
DBInfo.Username     = "LoginName";
DBInfo.Password     = "LoginPassword";

/* Create new instance of WIDatabase */
WIDB = new WIDatabase(DBInfo);

/* Set table name to be updated */
WIDB.Update.Table("tblTableName");

/* Set Columns and data to be updated */
Str = "PA";
WIDB.Update.Column("City", "Lancaster");
WIDB.Update.Column("State", Str);

/* Set Condition (WHERE) cause */
WIDB.Update.Condition("AddressID", eOperator.Equal, 128);

/* Execute Update statement */
if (!WIDB.Update.Execute())
   {
   MessageBox.Show(string.Format("Failed To Update record\n{0} - {1}", 
                   WIDB.LastError.ToString(), WIDB.LastErrorMessage));
   }

WIDB.Close();

Inheritance Hierarchy

System..::..Object
  Wiker.WIDatabase..::..CConditionCommon
    Wiker.WIDatabase..::..CUpdate

See Also