本文整理汇总了C#中SqlCeTransaction类的典型用法代码示例。如果您正苦于以下问题:C# SqlCeTransaction类的具体用法?C# SqlCeTransaction怎么用?C# SqlCeTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlCeTransaction类属于命名空间,在下文中一共展示了SqlCeTransaction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAddProductCommand
public SqlCeCommand CreateAddProductCommand(SqlCeConnection conn, SqlCeTransaction transaction)
{
var cmd = new SqlCeCommand(_sql, conn, transaction);
CreateParameters(cmd);
return cmd;
}
示例2: DeleteAllFileNames
public static void DeleteAllFileNames(SqlCeTransaction transaction, SqlCeConnection conn)
{
SqlCeCommand command = new SqlCeCommand(Folder_Names_SQL.commandDeleteAllFolderNames, conn);
command.Transaction = transaction;
command.Connection = conn;
command.ExecuteNonQuery();
}
示例3: DeletAllRespectiveCapturePointsForTextConversion
public static void DeletAllRespectiveCapturePointsForTextConversion(int captureEventId, SqlCeConnection conn, SqlCeTransaction transaction)
{
//pointRecId
int value = 0;
SqlCeCommand command = new SqlCeCommand(Rec_CapturePoints_TextConv_SQL.commandRemoveAllCapturePointsByRecIdTextConv, conn);
command.Transaction = transaction;
command.Parameters.Add("@pointRecId", captureEventId);
value = Convert.ToInt32(command.ExecuteNonQuery());
}
示例4: BeginTransaction
/// <summary>
/// Starts a Transaction using the Connection instance
/// </summary>
/// <returns>
/// The <see cref="SqlCeTransaction" />.
/// </returns>
public SqlCeTransaction BeginTransaction()
{
if (this.transaction != null)
{
throw new InvalidOperationException(
"A transaction has already been started. Only one transaction is allowed");
}
this.transaction = EntityBase.Connection.BeginTransaction();
this.UsersDB.Transaction = this.transaction;
return this.transaction;
}
示例5: SaveReplacementEventForTextConversion
public static void SaveReplacementEventForTextConversion(ReplacementEvent replacementEvent, SqlCeConnection conn, SqlCeTransaction transaction)
{
SqlCeCommand command = new SqlCeCommand(Advanced_Replacements_TextConv_SQL.commandUpdateReplacementByIdTextConv, conn);
command.Transaction = transaction;
command.Parameters.Add("@name", replacementEvent.name);
command.Parameters.Add("@description", replacementEvent.description);
command.Parameters.Add("@value", replacementEvent.Value);
command.Parameters.Add("@typeId", replacementEvent.typeId);
command.Parameters.Add("@capturePointId", replacementEvent.capturePointId);
command.Parameters.Add("@userId", replacementEvent.userId);
command.Parameters.Add("@usageCount", replacementEvent.usageCount);
command.Parameters.Add("@id", replacementEvent.id);
command.ExecuteNonQuery();
}
示例6: InsertFolderName
public static void InsertFolderName(int index, string folderName, object parentId, string generatedID, SqlCeTransaction transaction, SqlCeConnection conn)
{
try {
SqlCeCommand command = new SqlCeCommand(Folder_Names_SQL.commandInsertFolderName, conn);
command.Parameters.Add("@id", index);
command.Parameters.Add("@folderName", folderName);
command.Parameters.Add("@parentId", parentId);
command.Parameters.Add("@generatedID", generatedID);
command.Transaction = transaction;
command.Connection = conn;
command.ExecuteNonQuery();
} catch (Exception ex) {
CommonUtils.LogError(ex.Message, ex);
}
}
示例7: InsertUpdatedFileNames
public static void InsertUpdatedFileNames(List<TreeNode> treeNodes, SqlCeTransaction transaction, SqlCeConnection conn)
{
try {
for (int i = 0; i < treeNodes.Count; i++) {
int parentId = treeNodes[i].Parent == null ? -1 : treeNodes.IndexOf(treeNodes[i].Parent);
if (parentId != -1) {
InsertFolderName(i, treeNodes[i].Text, parentId, treeNodes[i].Tag.ToString(), transaction, conn);
} else {
InsertFolderName(i, treeNodes[i].Text, DBNull.Value, treeNodes[i].Tag.ToString(), transaction, conn);
}
}
} catch (Exception ex) {
CommonUtils.LogError(ex.Message,ex);
}
}
示例8: ExecuteNonQuery
/// <summary>
/// A SqlCeConnection extension method that executes the non query operation.
/// </summary>
/// <param name="this">The @this to act on.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="parameters">Options for controlling the operation.</param>
/// <param name="commandType">Type of the command.</param>
/// <param name="transaction">The transaction.</param>
public static void ExecuteNonQuery(this SqlCeConnection @this, string cmdText, SqlCeParameter[] parameters, CommandType commandType, SqlCeTransaction transaction)
{
using (SqlCeCommand command = @this.CreateCommand())
{
command.CommandText = cmdText;
command.CommandType = commandType;
command.Transaction = transaction;
if (parameters != null)
{
command.Parameters.AddRange(parameters);
}
command.ExecuteNonQuery();
}
}
示例9: SqlCeExecuteReader
/// <summary>
/// A SqlCeConnection extension method that executes the reader operation.
/// </summary>
/// <param name="this">The @this to act on.</param>
/// <param name="cmdText">The command text.</param>
/// <param name="parameters">Options for controlling the operation.</param>
/// <param name="commandType">Type of the command.</param>
/// <param name="transaction">The transaction.</param>
/// <returns>A SqlCeDataReader.</returns>
public static SqlCeDataReader SqlCeExecuteReader(this SqlCeConnection @this, string cmdText, SqlCeParameter[] parameters, CommandType commandType, SqlCeTransaction transaction)
{
using (SqlCeCommand command = @this.CreateCommand())
{
command.CommandText = cmdText;
command.CommandType = commandType;
command.Transaction = transaction;
if (parameters != null)
{
command.Parameters.AddRange(parameters);
}
return command.ExecuteReader();
}
}
示例10: OpenConnection
private void OpenConnection(SqlCeConnection aSqlCeConnection, SqlCeTransaction aSqlCeTransaction)
{
using (SqlCeCommand sqlCommand = new SqlCeCommand("SELECT s.Id_Session, s.Session, s.[DateTime] FROM Session AS s", aSqlCeConnection, aSqlCeTransaction))
{
sqlCommand.CommandType = CommandType.Text;
using (SqlCeDataReader rdr = sqlCommand.ExecuteReader())
{
if (rdr.Read())
{
FId_Session = (Int32)rdr["Id_Session"];
FSession = (Guid)rdr["Session"];
FDateTime = (DateTime)rdr["DateTime"];
}
}
}
}
示例11: InserNewCategory
public static int InserNewCategory(ComparisonCategory comparisonCategory, SqlCeTransaction transaction, SqlCeConnection conn)
{
SqlCeCommand command = new SqlCeCommand(Env_Comparison_Categories_SQL.commandInsertNewEnvComparisonCategory, conn);
command.Transaction = transaction;
command.Parameters.Add("@id", comparisonCategory.categoryId);
command.Parameters.Add("@name", comparisonCategory.categoryName);
command.Parameters.Add("@description", comparisonCategory.categoryDescription);
command.Parameters.Add("@path", comparisonCategory.categoryPath);
if (comparisonCategory.categoryParentId == -1) {
//DBNull.Value
command.Parameters.Add("@parentId", DBNull.Value);
} else {
command.Parameters.Add("@parentId", comparisonCategory.categoryParentId);
}
int numberAffectedRows = Convert.ToInt32(command.ExecuteNonQuery());
return numberAffectedRows;
}
示例12: Excluir
public int Excluir(SqlCeTransaction bdTrans)
{
//string sqlUpdateEstoque = "";
//Código temporariamente comentado por estar com erro 19/03/2009
// foreach (GradeItem gi in LstGradeItem)
// {
// //Recupera a quantidade do estoque
// string sqlPedidoOriginalQuantidade = @"
// select
// quantidade
// from
// item_pedido_grade
// where
// id_pedido=" + Globals.Pedido.Id + " and id_produto=" + Produto.Id +
// @" and id_grade = " + Produto.IdGrade.V +
// @" and id_item_grade = " + gi.IdItemGrade +
// @" and id_atributo = " + gi.IdAtributo +
// @" and id_item_atributo = " + gi.IdItemAtributo;
// IntN quantidadeOriginal = Globals.Bd.IntN(sqlPedidoOriginalQuantidade, bdTrans);
// if (quantidadeOriginal.Iniciada)
// {
// sqlUpdateEstoque = @"
// update
// saldo_grade
// set
// estoque=estoque + " + quantidadeOriginal.V + @"
// where
// id_produto=" + Produto.Id +
// @" and id_grade = " + Produto.IdGrade.V +
// @" and id_item_grade = " + gi.IdItemGrade +
// @" and id_atributo = " + gi.IdAtributo +
// @" and id_item_atributo = " + gi.IdItemAtributo;
// Globals.Bd.ExecuteNonQuery(sqlUpdateEstoque, bdTrans);
// }
// }
int rf;
string sqlDeleteItemGrade = @"
delete from
item_pedido_grade
where id_produto=" + Produto.Id + " and id_pedido='" + Produto.Pedido.Id + "'";
rf = D.Bd.ExecuteNonQuery(sqlDeleteItemGrade, bdTrans);
return rf;
}
示例13: BeforeEachExample
protected override void BeforeEachExample()
{
base.BeforeEachExample();
dbConnection = new SqlCeConnection(DatabaseIntegrationSetup.TestDBConnectionString);
dbConnection.Open();
transaction = dbConnection.BeginTransaction();
}
示例14: BeginTran
/// <summary>
/// Starts a Transaction session on the current connection.
/// </summary>
public void BeginTran()
{
if (oConn.State == ConnectionState.Open)
{
oTran = oConn.BeginTransaction();
blnTranActive = true;
}
}
示例15: commitTransaction
public void commitTransaction()
{
if ((con != null) && (trans != null) && (con.State == System.Data.ConnectionState.Open))
{
trans.Commit();
trans = null;
}
}