コード例 #1
0
        private MySqlCommand CreateUpdateCommand()
        {
            if (this._updateCmd != null)
            {
                return(this._updateCmd);
            }
            MySqlCommand  mySqlCommand  = this.CreateBaseCommand();
            StringBuilder stringBuilder = new StringBuilder();

            foreach (Object o in this._schema.Rows)
            {
                DataRow dataRow = (DataRow)o;
                string  text    = (string)dataRow["BaseTableName"];
                if (text != null && text.Length != 0)
                {
                    string text2 = this.Quote((string)dataRow["ColumnName"]);
                    if (MySqlCommandBuilder.IncludedInUpdate(dataRow))
                    {
                        if (stringBuilder.Length > 0)
                        {
                            stringBuilder.Append(", ");
                        }
                        MySqlParameter mySqlParameter = this.CreateParameter(dataRow, false);
                        mySqlCommand.Parameters.Add(mySqlParameter);
                        stringBuilder.Append(text2 + "=" + mySqlParameter.ParameterName);
                    }
                }
            }
            mySqlCommand.CommandText = string.Concat(new string[]
            {
                "UPDATE ",
                this.TableName,
                " SET ",
                stringBuilder.ToString(),
                " WHERE ",
                this.CreateOriginalWhere(mySqlCommand)
            });
            MySqlCommand expr_137 = mySqlCommand;

            expr_137.CommandText = expr_137.CommandText + "; " + this.CreateFinalSelect(false);
            this._updateCmd      = mySqlCommand;
            return(mySqlCommand);
        }