当前位置: 首页>>代码示例>>C#>>正文


C# SqlCeTransaction类代码示例

本文整理汇总了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;
        }
开发者ID:cwbrandsma,项目名称:FluentAdo,代码行数:7,代码来源:InsertPerformanceTests.cs

示例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();
 }
开发者ID:mzkabbani,项目名称:cSharpProjects,代码行数:7,代码来源:Folder_Names.cs

示例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());
 }
开发者ID:mzkabbani,项目名称:XMLParser,代码行数:9,代码来源:Rec_CapturePoints_TextConv.cs

示例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;
        }
开发者ID:novaksam,项目名称:CIS499_C-_IM_Package,代码行数:18,代码来源:DataRepository.cs

示例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();
 }
开发者ID:mzkabbani,项目名称:XMLParser,代码行数:14,代码来源:Advanced_Replacements_TextConv.cs

示例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);
     }
 }
开发者ID:mzkabbani,项目名称:cSharpProjects,代码行数:15,代码来源:Folder_Names.cs

示例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);
     }
 }
开发者ID:mzkabbani,项目名称:cSharpProjects,代码行数:15,代码来源:Folder_Names.cs

示例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();
        }
    }
开发者ID:ChuangYang,项目名称:Z.ExtensionMethods,代码行数:24,代码来源:SqlCeConnection.ExecuteNonQuery.cs

示例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();
        }
    }
开发者ID:huoxudong125,项目名称:Z.ExtensionMethods,代码行数:25,代码来源:SqlCeConnection.SqlCeExecuteReader.cs

示例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"];
             }
         }
     }
 }
开发者ID:BeL1kOFF,项目名称:SHATE,代码行数:16,代码来源:ObjectSession.cs

示例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;
 }
开发者ID:mzkabbani,项目名称:cSharpProjects,代码行数:17,代码来源:Env_Comparison_Categories.cs

示例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;
        }
开发者ID:evandrojr,项目名称:NeoPocket,代码行数:46,代码来源:Grade.cs

示例13: BeforeEachExample

 protected override void BeforeEachExample()
 {
     base.BeforeEachExample();
     dbConnection = new SqlCeConnection(DatabaseIntegrationSetup.TestDBConnectionString);
     dbConnection.Open();
     transaction = dbConnection.BeginTransaction();
 }
开发者ID:rockhymas,项目名称:speceasy,代码行数:7,代码来源:DatabaseIntegrationSpec.cs

示例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;
     }
 }
开发者ID:riskypathak,项目名称:WebSpider,代码行数:11,代码来源:SqlCeDataConnection.cs

示例15: commitTransaction

 public void commitTransaction()
 {
     if ((con != null) && (trans != null) && (con.State == System.Data.ConnectionState.Open))
     {
         trans.Commit();
         trans = null;
     }
 }
开发者ID:mariomarques123,项目名称:esi,代码行数:8,代码来源:Banco.cs


注:本文中的SqlCeTransaction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。