本文整理汇总了C#中Database.ExecuteNonQueryHelper方法的典型用法代码示例。如果您正苦于以下问题:C# Database.ExecuteNonQueryHelper方法的具体用法?C# Database.ExecuteNonQueryHelper怎么用?C# Database.ExecuteNonQueryHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database.ExecuteNonQueryHelper方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteInsert
public override object ExecuteInsert(Database db, IDbCommand cmd, string PrimaryKeyName)
{
if (PrimaryKeyName != null)
{
cmd.CommandText += string.Format(" returning {0} into :newid", this.EscapeSqlIdentifier(PrimaryKeyName));
IDbDataParameter dbDataParameter = cmd.CreateParameter();
dbDataParameter.ParameterName = ":newid";
dbDataParameter.Value = System.DBNull.Value;
dbDataParameter.Direction = ParameterDirection.ReturnValue;
dbDataParameter.DbType = DbType.Int64;
cmd.Parameters.Add(dbDataParameter);
db.ExecuteNonQueryHelper(cmd);
return dbDataParameter.Value;
}
db.ExecuteNonQueryHelper(cmd);
return -1;
}
示例2: 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;
}
示例3: 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;
}
示例4: ExecuteInsert
public override object ExecuteInsert(Database db, IDbCommand cmd, string primaryKeyName)
{
if (primaryKeyName != null)
{
cmd.CommandText += string.Format(" returning {0} into :newid", EscapeSqlIdentifier(primaryKeyName));
var param = cmd.CreateParameter();
param.ParameterName = ":newid";
param.Value = DBNull.Value;
param.Direction = ParameterDirection.ReturnValue;
param.DbType = DbType.Int64;
cmd.Parameters.Add(param);
db.ExecuteNonQueryHelper(cmd);
return param.Value;
}
else
{
db.ExecuteNonQueryHelper(cmd);
return -1;
}
}
示例5: ExecuteInsert
public override object ExecuteInsert(Database db, System.Data.IDbCommand cmd, string PrimaryKeyName)
{
db.ExecuteNonQueryHelper(cmd);
return db.ExecuteScalar<object>("SELECT @@@IDENTITY AS NewID;");
}
示例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);
}