本文整理汇总了C#中SqlStatement.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# SqlStatement.Execute方法的具体用法?C# SqlStatement.Execute怎么用?C# SqlStatement.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlStatement
的用法示例。
在下文中一共展示了SqlStatement.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRawTableData
private SqlResult GetRawTableData()
{
SqlBuilder sb = new SqlBuilder( StatementType.Select, typeof(PHNullableType) );
SqlStatement stmt = sb.GetStatement( true );
// override generated statement to make sure we execute this without any type association
stmt = new SqlStatement( StatementType.Select, Broker.Provider.GetCommand(), stmt.Sql );
SqlResult sr = stmt.Execute();
return sr;
}
示例2: ExecuteInsert
public override LastInsertId ExecuteInsert(SqlStatement sql, string idKey)
{
if (idKey != null)
{
sql.Sql += ";SELECT last_insert_rowid()";
using (sql)
{
var rez = sql.ExecuteScalar();
return new LastInsertId(rez);
}
}
sql.Execute();
return LastInsertId.Empty;
}
示例3: ExecuteInsert
public override LastInsertId ExecuteInsert(SqlStatement sql, string idKey)
{
//sql.Sql += ";Select @@IDENTITY as id";
using (sql)
{
sql.Execute();
using (var idquery = new SqlStatement(sql.Db))
{
idquery.SetSql("select @@IDENTITY as id");
var rez = idquery.ExecuteScalar();
return new LastInsertId(rez);
}
}
}
示例4: ExecuteInsert
public override LastInsertId ExecuteInsert(SqlStatement sql, string idKey)
{
IDbDataParameter param = null;
if (!string.IsNullOrEmpty(idKey))
{
sql.Sql += string.Format(" returning {0} into :newid", EscapeName(idKey));
var cmd = sql.Command;
param = cmd.CreateParameter();
param.ParameterName = ":newid";
param.Value = DBNull.Value;
param.Direction = ParameterDirection.ReturnValue;
param.DbType = DbType.Int64;
cmd.Parameters.Add(param);
}
using (sql)
{
sql.Execute();
if (param == null) return LastInsertId.Empty;
return new LastInsertId(param.Value);
}
}