本文整理汇总了C#中DBManager.CreateCommand方法的典型用法代码示例。如果您正苦于以下问题:C# DBManager.CreateCommand方法的具体用法?C# DBManager.CreateCommand怎么用?C# DBManager.CreateCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager.CreateCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCustomQuery
/// <summary>
/// Bu metot kendi kompleks sorgunuzu oluşturabilmenizi sağlar.
/// This method can be used to perform complex queries.
/// </summary>
/// <param name="query">Query statement.</param>
/// <param name="parameters">Query parameters. This is not a required.</param>
/// <returns>This method will return DbDataReader object.</returns>
public DbDataReader ExecuteCustomQuery(string query, object parameters = null)
{
var dbManager = new DBManager(OrmConfiguration);
dbManager.CreateCommand(query);
if (parameters != null)
dbManager.AddParameter(parameters);
var reader = dbManager.ExecuteReader();
return reader;
}
示例2: SubmitChanges
/// <summary>
/// Ekleme, silme veya güncelleme gibi yapılmış olan işlemleri, veritabanında uygulamayı sağlar.
/// Allows you to perform insert, delete or update operations on the database.
/// </summary>
/// <returns></returns>
public int SubmitChanges()
{
var dbManager = new DBManager(OrmConfiguration);
dbManager.CreateCommand(DBManager.CommandText);
if (DBManager.CommandParameters != null && DBManager.CommandParameters.Count > 0)
foreach (var loopParameter in DBManager.CommandParameters)
{
dbManager.AddParameter(loopParameter.Key.ToString(), loopParameter.Value);
}
int status = dbManager.ExecuteNonQuery();
return status;
}