Exemplo n.º 1
0
        /// <summary>
        /// 增加参数
        /// </summary>
        internal void AppendParameters()
        {
            this.DbCommand.Parameters.Clear();
            switch (this.DbConType)                     //根据数据链接类型判断如何增加参数
            {
            case "OdbcConnection":
            case "OleDbConnection":
                this.DbCommand.CommandText = FindArgument.Replace(this.DbCommand.CommandText, new MatchEvaluator(this.ReplaceSub));
                break;

            default:
                foreach (Match myMatch in FindArgument.Matches(this.DbCommand.CommandText))
                {
                    string Item = myMatch.Value;
                    if (Item[0] != '@')
                    {
                        continue;
                    }
                    FieldAttrib myFieldAttrib = this.Fields[Item.TrimStart('@')];
                    if (myFieldAttrib == null)
                    {
                        throw new ReportException("无法获取参数" + Item);
                    }
                    IDbDataParameter myParameter = myFieldAttrib.GetParameter();
                    if (!this.DbCommand.Parameters.Contains(myParameter))
                    {
                        this.DbCommand.Parameters.Add(myParameter);
                    }
                }
                break;
            }
        }
Exemplo n.º 2
0
 public FindEventArg(string findtext, FindArgument arguments, FindPattren pattren)
 {
     if (findtext == null)
     {
         throw new ArgumentNullException("findtext");
     }
     if (Microsoft.VisualBasic.Information.IsNothing(arguments))
     {
         throw new ArgumentNullException("arguments");
     }
     if (Microsoft.VisualBasic.Information.IsNothing(pattren))
     {
         throw new ArgumentNullException("pattren");
     }
     FindText = findtext;
     Arguments = arguments;
     Pattren = pattren;
 }