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


C# Microsoft.ExecuteNonQuery方法代码示例

本文整理汇总了C#中Microsoft.ExecuteNonQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.ExecuteNonQuery方法的具体用法?C# Microsoft.ExecuteNonQuery怎么用?C# Microsoft.ExecuteNonQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft的用法示例。


在下文中一共展示了Microsoft.ExecuteNonQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Insert

        public override bool Insert(string newKeyValue, System.Collections.Hashtable dataControlCollection, Microsoft.Practices.EnterpriseLibrary.Data.Database db, System.Data.Common.DbTransaction transaction)
        {
            if (base.Insert(newKeyValue, dataControlCollection, db, transaction))
            {
                DbCommand cmd = db.GetStoredProcCommand("wcs.AddCellDirection");
                db.AddInParameter(cmd, "pWhId", DbType.Int32, KeyValue);
                db.ExecuteNonQuery(cmd, transaction);
                return true;
            }

            return true;
        }
开发者ID:HeyWeiPan,项目名称:WarehouseControlSystem,代码行数:12,代码来源:WCSWH.cs

示例2: ExecuteWriteLogStoredProcedure

        /// <summary>
        /// Executes the WriteLog stored procedure
        /// </summary>
        /// <param name="msgEntry">The MsgEntry to store in the database.</param>
        /// <param name="db">An instance of the database class to use for storing the MsgEntry</param>
        /// <param name="transaction">The transaction that wraps around the execution calls for storing the MsgEntry</param>
        /// <returns>An integer for the MsgEntry Id</returns>
        private int ExecuteWriteLogStoredProcedure(MsgEntry msgEntry, Microsoft.Practices.EnterpriseLibrary.Data.Database db, DbTransaction transaction)
        {
            DbCommand cmd = db.GetStoredProcCommand(writeLogStoredProcName);

            //db.AddInParameter(cmd, "eventID", DbType.Int32, msgEntry.EventId);
            //db.AddInParameter(cmd, "priority", DbType.Int32, msgEntry.Priority);
            //db.AddParameter(cmd, "severity", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Severity.ToString());
            //db.AddParameter(cmd, "title", DbType.String, 256, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Title);
            //db.AddInParameter(cmd, "timestamp", DbType.DateTime, msgEntry.TimeStamp);
            //db.AddParameter(cmd, "machineName", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.MachineName);
            //db.AddParameter(cmd, "AppDomainName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.AppDomainName);
            //db.AddParameter(cmd, "ProcessID", DbType.String, 256, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.ProcessId);
            //db.AddParameter(cmd, "ProcessName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.ProcessName);
            //db.AddParameter(cmd, "ThreadName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.ManagedThreadName);
            //db.AddParameter(cmd, "Win32ThreadId", DbType.String, 128, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Win32ThreadId);
            //db.AddParameter(cmd, "message", DbType.String, 1500, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Message);

            //if (Formatter != null)
            //    db.AddInParameter(cmd, "formattedmessage", DbType.String, Formatter.Format(msgEntry));
            //else
            //    db.AddInParameter(cmd, "formattedmessage", DbType.String, msgEntry.Message);

            //db.AddOutParameter(cmd, "LogId", DbType.Int32, 4);

            db.ExecuteNonQuery(cmd, transaction);
            int logId = Convert.ToInt32(cmd.Parameters[cmd.Parameters.Count - 1].Value, CultureInfo.InvariantCulture);
            return logId;
        }
开发者ID:Ampy,项目名称:Work,代码行数:35,代码来源:FormattedDatabaseTraceListener.cs

示例3: ExecuteAddCategoryStoredProcedure

 /// <summary>
 /// Executes the AddCategory stored procedure
 /// </summary>
 /// <param name="msgEntry">The MsgEntry to store in the database.</param>
 /// <param name="logID">The unique identifer for the MsgEntry as obtained from the WriteLog Stored procedure.</param>
 /// <param name="db">An instance of the database class to use for storing the MsgEntry</param>
 /// <param name="transaction">The transaction that wraps around the execution calls for storing the MsgEntry</param>
 private void ExecuteAddCategoryStoredProcedure(MsgEntry msgEntry, int logID, Microsoft.Practices.EnterpriseLibrary.Data.Database db, DbTransaction transaction)
 {
     foreach (string category in msgEntry.Categories)
     {
         DbCommand cmd = db.GetStoredProcCommand(addCategoryStoredProcName);
         db.AddInParameter(cmd, "categoryName", DbType.String, category);
         db.AddInParameter(cmd, "logID", DbType.Int32, logID);
         db.ExecuteNonQuery(cmd, transaction);
     }
 }
开发者ID:Ampy,项目名称:Work,代码行数:17,代码来源:FormattedDatabaseTraceListener.cs

示例4: DeleteLoginUser

 private Arthur.PurchaseEntryDL.TransactionResult DeleteLoginUser(Microsoft.Practices.EnterpriseLibrary.Data.Database db, System.Data.Common.DbTransaction transaction)
 {
     Arthur.PurchaseEntryDL.TransactionResult transactionResult;
     int i = 0;
     System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand("spDeleteLoginUser");
     db.AddInParameter(dbCommand, "LoginID", System.Data.DbType.Int32, this._loginId);
     db.AddParameter(dbCommand, "Return Value", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "Return Value", System.Data.DataRowVersion.Default, i);
     db.ExecuteNonQuery(dbCommand, transaction);
     i = (int)db.GetParameterValue(dbCommand, "Return Value");
     transactionResult = i == -1 ? new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "Failure Deleted") : new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Success, "Successfully Deleted");
     return transactionResult;
 }
开发者ID:samdoss,项目名称:AMSystem,代码行数:12,代码来源:Login.cs

示例5: AddEditLoginUser

 private Arthur.PurchaseEntryDL.TransactionResult AddEditLoginUser(Microsoft.Practices.EnterpriseLibrary.Data.Database db, System.Data.Common.DbTransaction transaction)
 {
     int i;
     Arthur.PurchaseEntryDL.TransactionResult transactionResult;
     bool bl;
     i = 0;
     System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand("spAddEditLoginUser");
     db.AddInParameter(dbCommand, "LoginID", System.Data.DbType.Int32, this._loginId);
     db.AddInParameter(dbCommand, "CompanyID", System.Data.DbType.Int32, this._companyId);
     db.AddInParameter(dbCommand, "UserName", System.Data.DbType.String, this._userName);
     db.AddInParameter(dbCommand, "Password", System.Data.DbType.String, this._password);
     db.AddInParameter(dbCommand, "RoleID", System.Data.DbType.String, this._roleId);
     db.AddInParameter(dbCommand, "LoginAccess", System.Data.DbType.Boolean, this._loginAccess);
     db.AddInParameter(dbCommand, "AddEditOption", System.Data.DbType.Int16, this._addEditOption);
     db.AddParameter(dbCommand, "Return Value", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "Return Value", System.Data.DataRowVersion.Default, i);
     db.ExecuteNonQuery(dbCommand, transaction);
     this._loginId = (int)db.GetParameterValue(dbCommand, "Return Value");
     bl = i != 0;
     if (!bl)
     {
         transactionResult = new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "User Name Already Exists. Please Change Some Other Name");
     }
     else
     {
         bl = i != -1;
         if (!bl)
         {
             bl = this._addEditOption != 1;
             if (!bl)
             {
                 return new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "Failure Updated");
             }
             transactionResult = new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "Failure Adding");
         }
         else
         {
             bl = this._addEditOption != 1;
             transactionResult = !bl ? new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Success, "Successfully Updated") : new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Success, "Successfully Added");
         }
     }
     return transactionResult;
 }
开发者ID:samdoss,项目名称:AMSystem,代码行数:42,代码来源:Login.cs


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