本文整理汇总了C#中Datum.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# Datum.Insert方法的具体用法?C# Datum.Insert怎么用?C# Datum.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datum
的用法示例。
在下文中一共展示了Datum.Insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save()
{
dynamic datum = new Datum("Items");
datum.cid = this.Character.ID;
datum.itemId = this.ItemID;
datum.quantity = this.Quantity;
datum.slot = this.Slot;
if (this.Assigned)
{
datum.Update("id = '{0}'", this.ID);
}
else
{
datum.Insert();
this.ID = Database.Fetch("Items", "id", "cid = '{0}' && itemId = '{1}' && slot = '{2}'", this.Character.ID, this.ItemID, this.Slot);
this.Assigned = true;
}
}
示例2: Save
public void Save()
{
dynamic datum = new Datum("Characters");
datum.accountId = this.AccountID;
datum.worldId = this.WorldID;
datum.name = this.Name;
datum.title = this.Title;
datum.gender = this.Gender;
datum.hair = this.Hair;
datum.eyes = this.Eyes;
datum.level = this.Level;
datum.classId = this.Class;
datum.classLv = this.ClassLV;
datum.hp = this.Hp;
datum.maxHp = this.MaxHp;
datum.sp = this.Sp;
datum.maxSp = this.MaxSp;
datum.exp = this.Exp;
datum.rank = this.Rank;
datum.c_str = this.Str;
datum.c_dex = this.Dex;
datum.c_vit = this.Vit;
datum.c_int = this.Int;
if (this.Assigned)
{
datum.Update("id = '{0}'", this.ID);
}
else
{
datum.Insert();
this.ID = Database.Fetch("Characters", "id", "name = '{0}'", this.Name);
this.Assigned = true;
}
this.Items.Save();
Log.Inform("角色'{0}'的資料已儲存至資料庫。", this.Name);
}