本文整理汇总了C#中OpenCbsCommand.ExecuteNonQuery方法的典型用法代码示例。如果您正苦于以下问题:C# OpenCbsCommand.ExecuteNonQuery方法的具体用法?C# OpenCbsCommand.ExecuteNonQuery怎么用?C# OpenCbsCommand.ExecuteNonQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCbsCommand
的用法示例。
在下文中一共展示了OpenCbsCommand.ExecuteNonQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteAllProvisioningRules
public void DeleteAllProvisioningRules(SqlTransaction sqlTransac)
{
const string sqlText = "DELETE FROM ProvisioningRules";
using (OpenCbsCommand delete = new OpenCbsCommand(sqlText, sqlTransac.Connection, sqlTransac))
{
delete.ExecuteNonQuery();
}
}
示例2: Delete
public void Delete(SqlTransaction pSqlTransaction)
{
const string sqltext = "DELETE FROM LoanScale";
using (OpenCbsCommand delete = new OpenCbsCommand(sqltext, pSqlTransaction.Connection, pSqlTransaction))
{
delete.ExecuteNonQuery();
}
}
示例3: InsertLoanScale
public void InsertLoanScale(LoanScaleRate pLoanScaleRate, SqlTransaction pSqlTransaction)
{
const string sqlText = @"INSERT INTO LoanScale(id,ScaleMin, ScaleMax) VALUES(@number,@Min, @Max)";
using (OpenCbsCommand insert = new OpenCbsCommand(sqlText, pSqlTransaction.Connection, pSqlTransaction))
{
SetLoanScale(insert, pLoanScaleRate);
insert.ExecuteNonQuery();
}
}
示例4: Add
public void Add(DateTime pDate, double pRate, Currency pCurrency)
{
const string q = "INSERT INTO [ExchangeRates] ([exchange_date], [exchange_rate],[currency_id]) " +
"VALUES(@date,@rate,@currency)";
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand c = new OpenCbsCommand(q, conn))
{
SetExchangeRate(c, pDate.Date, pRate,pCurrency);
c.ExecuteNonQuery();
}
}
示例5: DeleteStandardBooking
public void DeleteStandardBooking(int id)
{
const string sqlText = @"DELETE FROM StandardBookings WHERE Id = @Id";
using (SqlConnection conn = GetConnection())
{
using (OpenCbsCommand insertIntoTable = new OpenCbsCommand(sqlText, conn))
{
insertIntoTable.AddParam("@Id", id);
insertIntoTable.ExecuteNonQuery();
}
}
}
示例6: CreateStandardBooking
public void CreateStandardBooking(Booking booking)
{
const string sqlText = @"INSERT INTO StandardBookings([Name], debit_account_id, credit_account_id)
VALUES (@name, @debit_account_id, @credit_account_id)";
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand insertIntoTable = new OpenCbsCommand(sqlText, conn))
{
insertIntoTable.AddParam("@name", booking.Name);
insertIntoTable.AddParam("@debit_account_id", booking.DebitAccount.Id);
insertIntoTable.AddParam("@credit_account_id", booking.CreditAccount.Id);
insertIntoTable.ExecuteNonQuery();
}
}
示例7: AddDatabaseToAccounts
public static void AddDatabaseToAccounts(string pAccountName, string pDatabaseName, string pLogin, string pPassword, SqlConnection pSqlConnection)
{
const string sqlText = @"INSERT INTO [Accounts].[dbo].[SqlAccounts]
([account_name],[database_name],[user_name],[password],[active])
VALUES (@accountName, @databaseName, @login, @password,1)";
using (OpenCbsCommand insert = new OpenCbsCommand(sqlText, pSqlConnection))
{
insert.AddParam("@accountName", pAccountName);
insert.AddParam("@databaseName", pDatabaseName);
insert.AddParam("@login", pLogin);
insert.AddParam("@password", pPassword);
insert.ExecuteNonQuery();
}
}
示例8: AddCreditInsuranceEvent
public void AddCreditInsuranceEvent(CreditInsuranceEvent pEvent, SqlTransaction pSqlTransac)
{
const string q = @"
INSERT INTO [dbo].[CreditInsuranceEvents]
([id]
,[commission]
,[principal])
VALUES
(@id
,@commission
,@principal)";
using (OpenCbsCommand c = new OpenCbsCommand(q, pSqlTransac.Connection, pSqlTransac))
{
SetCreditInsuranceEvent(pEvent, c);
c.ExecuteNonQuery();
}
}
示例9: AddParameter
public void AddParameter(DictionaryEntry entry)
{
ApplicationSettings.GetInstance(_user.Md5).AddParameter(entry.Key.ToString(), entry.Value);
string sqlText = "INSERT INTO [GeneralParameters]([key], [value])" +
" VALUES(@name,@value)";
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand c = new OpenCbsCommand(sqlText, conn))
{
c.AddParam("@name", entry.Key.ToString());
if (entry.Value != null)
c.AddParam("@value", entry.Value.ToString());
else
c.AddParam("@value", null);
c.ExecuteNonQuery();
}
}
示例10: ShrinkDatabase
public static void ShrinkDatabase(string pDatabaseName, SqlConnection pSqlConnection)
{
string database = TechnicalSettings.DatabaseName;
string sql1 = String.Format("ALTER DATABASE {0} SET RECOVERY SIMPLE", database);
string sql2 = String.Format("ALTER DATABASE {0} SET AUTO_SHRINK ON", database);
try
{
OpenCbsCommand cmd = new OpenCbsCommand(sql1, pSqlConnection);
cmd.ExecuteNonQuery();
cmd = new OpenCbsCommand(sql2, pSqlConnection);
cmd.ExecuteNonQuery();
string sql = String.Format("DBCC SHRINKDATABASE ({0})", database);
cmd = new OpenCbsCommand(sql, pSqlConnection);
cmd.ExecuteNonQuery();
}
catch (Exception) { }
}
示例11: DeleteDatabase
public static void DeleteDatabase(string pDatabaseName, SqlConnection pSqlConnection)
{
string sqlText = string.Format("ALTER DATABASE {0} SET SINGLE_USER WITH ROLLBACK IMMEDIATE", pDatabaseName);
OpenCbsCommand cmd = new OpenCbsCommand(sqlText, pSqlConnection);
cmd.ExecuteNonQuery();
sqlText = "DROP DATABASE " + pDatabaseName;
cmd = new OpenCbsCommand(sqlText, pSqlConnection);
cmd.ExecuteNonQuery();
}
示例12: UpdateSavingContractCode
public void UpdateSavingContractCode(int savingsId, string code, SqlTransaction pSqlTransac)
{
const string sqlText = @"UPDATE SavingContracts SET code = @code WHERE id = @id";
using (OpenCbsCommand cmd = new OpenCbsCommand(sqlText, pSqlTransac.Connection, pSqlTransac))
{
cmd.AddParam("@code", code);
cmd.AddParam("@id", savingsId);
cmd.ExecuteNonQuery();
}
}
示例13: UpdateNextMaturityForSavingBook
public void UpdateNextMaturityForSavingBook(int savingId, DateTime? nextMaturity)
{
const string sqlText =
@"UPDATE SavingBookContracts
SET next_maturity = @nextMaturity
WHERE id = @id";
using (SqlConnection conn = GetConnection())
using (OpenCbsCommand cmd = new OpenCbsCommand(sqlText, conn))
{
cmd.AddParam("@nextMaturity", nextMaturity);
cmd.AddParam("@id", savingId);
cmd.ExecuteNonQuery();
}
}
示例14: AddCollateralPropertyValue
public void AddCollateralPropertyValue(ContractCollateral contractCollateral, CollateralPropertyValue propertyValue, SqlTransaction pSqlTransac)
{
string q = @"INSERT INTO [CollateralPropertyValues] ([contract_collateral_id], [property_id], [value])
VALUES (@contract_collateral_id, @property_id, @value)";
using (OpenCbsCommand c = new OpenCbsCommand(q, pSqlTransac.Connection, pSqlTransac))
{
c.AddParam("@contract_collateral_id", contractCollateral.Id);
c.AddParam("@property_id", propertyValue.Property.Id);
c.AddParam("@value", propertyValue.Value);
c.ExecuteNonQuery();
}
}
示例15: _SetLoanShareAmount
private void _SetLoanShareAmount(Loan pLoan, SqlTransaction pSqlTransac)
{
// Get group id
int group_id;
const string q = @"SELECT p.tiers_id
FROM dbo.Projects AS p
LEFT JOIN dbo.Contracts AS c ON c.project_id = p.id
WHERE c.id = @contract_id";
using (OpenCbsCommand c = new OpenCbsCommand(q, pSqlTransac.Connection, pSqlTransac))
{
c.AddParam("@contract_id", pLoan.Id);
group_id = Convert.ToInt32(c.ExecuteScalar());
}
const string sqlText = @"INSERT INTO LoanShareAmounts (person_id, group_id, contract_id, amount)
VALUES (@person_id, @group_id, @contract_id, @amount)";
using(OpenCbsCommand c = new OpenCbsCommand(sqlText, pSqlTransac.Connection, pSqlTransac))
{
foreach (LoanShare ls in pLoan.LoanShares)
{
c.ResetParams();
c.AddParam("@person_id", ls.PersonId);
c.AddParam("@group_id", group_id);
c.AddParam("@contract_id", pLoan.Id);
c.AddParam("@amount", ls.Amount.Value);
c.ExecuteNonQuery();
}
}
}