本文整理汇总了C#中Database.ExecuteScalarHelper方法的典型用法代码示例。如果您正苦于以下问题:C# Database.ExecuteScalarHelper方法的具体用法?C# Database.ExecuteScalarHelper怎么用?C# Database.ExecuteScalarHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database.ExecuteScalarHelper方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteInsert
public override object ExecuteInsert(Database db, IDbCommand cmd, string PrimaryKeyName)
{
if (PrimaryKeyName != null)
{
cmd.CommandText += ";\nSELECT last_insert_rowid();";
return db.ExecuteScalarHelper(cmd);
}
db.ExecuteNonQueryHelper(cmd);
return -1;
}
示例2: ExecuteInsert
public override object ExecuteInsert(Database db, IDbCommand cmd, string PrimaryKeyName)
{
if (PrimaryKeyName != null)
{
cmd.CommandText += string.Format("returning {0} as NewID", this.EscapeSqlIdentifier(PrimaryKeyName));
return db.ExecuteScalarHelper(cmd);
}
db.ExecuteNonQueryHelper(cmd);
return -1;
}
示例3: ExecuteInsert
public override object ExecuteInsert(Database database, IDbCommand cmd, string primaryKeyName)
{
cmd.CommandText = cmd.CommandText.TrimEnd();
if (cmd.CommandText.EndsWith(";"))
cmd.CommandText = cmd.CommandText.Substring(0, cmd.CommandText.Length - 1);
cmd.CommandText += " RETURNING " + EscapeSqlIdentifier(primaryKeyName) + ";";
return database.ExecuteScalarHelper(cmd);
}
示例4: ExecuteInsert
/// <summary>
/// 执行插入操作
/// </summary>
/// <param name="db">数据库对象</param>
/// <param name="cmd">要执行插入的命令</param>
/// <param name="PrimaryKeyName">主键名</param>
/// <returns>插入后的主键值</returns>
public virtual object ExecuteInsert(Database db, IDbCommand cmd, string PrimaryKeyName)
{
cmd.CommandText += ";\nSELECT @@IDENTITY AS NewID;";
return db.ExecuteScalarHelper(cmd);
}
示例5: ExecuteInsert
public override object ExecuteInsert(Database db, System.Data.IDbCommand cmd, string primaryKeyName)
{
return db.ExecuteScalarHelper(cmd);
}
示例6: ExecuteInsert
public override object ExecuteInsert(Database database, IDbCommand cmd, string primaryKeyName)
{
database.ExecuteNonQueryHelper(cmd);
cmd.CommandText = "SELECT @@IDENTITY AS NewID;";
return database.ExecuteScalarHelper(cmd);
}