Esempio n. 1
0
        /// <summary>
        /// 設定資料庫命令字串,並用命令參數集合做格式化字串。
        /// </summary>
        /// <param name="commandText">命令字串。</param>
        public void SetCommandFormatText(string commandText)
        {
            StringBuilder oBuffer;

            if (StrFunc.StrContains(commandText, CommandTextVariable.Parameters))
            {
                oBuffer = new StringBuilder();
                for (int N1 = 0; N1 < this.DbCommand.Parameters.Count; N1++)
                {
                    StrFunc.StrMerge(oBuffer, "{" + N1 + "}", ",");
                }
                commandText = StrFunc.StrReplace(commandText, CommandTextVariable.Parameters, oBuffer.ToString());
            }

            commandText = StrFunc.StrUpper(commandText);
            this.DbCommand.CommandText = StrFunc.SQLFormat(commandText, this.DbCommand.Parameters);
        }