System.Data.SqlClient.SqlCommandBuilder.GetDeleteCommand C# (CSharp) Method

GetDeleteCommand() public method

public GetDeleteCommand ( ) : SqlCommand
return SqlCommand
		public SqlCommand GetDeleteCommand ()
		{
			BuildCache (true);
			return CreateDeleteCommand (null, null);
		}

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// 保存数据表所做的更改(带事务)
        /// </summary>
        /// <param name="conn">SqlTransaction</param>
        /// <param name="trans">SqlTransaction</param>
        /// <param name="strSQL">需要更新的表的SQL语句</param>
        /// <param name="dt">需要更新的DataTable</param>
        public static void SaveChangesOnTrans(SDC.SqlConnection conn, SDC.SqlTransaction trans, string strSQL, SD.DataTable dt)
        {
            //this.Validate();

            try
            {
                using (sqlcmd = new SDC.SqlCommand(strSQL, conn, trans))
                {
                    using (sqladp = new SDC.SqlDataAdapter(sqlcmd))
                    {
                        //sqladp.InsertCommand.Transaction = trans;
                        using (sqlcmdbd = new SDC.SqlCommandBuilder(sqladp))
                        {
                            sqlcmdbd.ConflictOption = SD.ConflictOption.CompareRowVersion;

                            sqladp.InsertCommand = sqlcmdbd.GetInsertCommand();
                            sqladp.UpdateCommand = sqlcmdbd.GetUpdateCommand();
                            sqladp.DeleteCommand = sqlcmdbd.GetDeleteCommand();

                            sqladp.Update(dt);
                        }
                    }
                }
            }
            catch (SDC.SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
All Usage Examples Of System.Data.SqlClient.SqlCommandBuilder::GetDeleteCommand