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


C# SqlParameter.Equals方法代码示例

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


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

示例1: ParseParameters

        private SqlParameter[] ParseParameters(Hashtable inputData)
        {
            if (String.IsNullOrEmpty(parameterString))
                return null;

            //get parm string from job spec and build array of parms
            string[] ps = parameterString.Split(';');
            SqlParameter[] parameters = new SqlParameter[ps.Length];

            //enumerate each parn specification and add new parm to parm array
            int i = 0;
            foreach (string pp in ps)
            {
                string parmValue;
                string parmName;
                SqlDbType parmType;

                // see if parm spec is fully defined
                string[] parms = pp.Split('=');
                if (parms.Length <= 0)
                {
                    log.WarnFormat("No parms found [{0}] ", pp);
                    return parameters;
                }

                // break down parm spec into name and type
                if (parms[0].IndexOf(",") > -1)
                {
                    string[] parmDef = parms[0].Split(',');
                    parmName = parmDef[0].Replace("\"", "");
                    parmType = Bits.Common.Utilities.DataUtils.ConvertToDbType(parmDef[1].Replace("\"", ""));
                }
                else
                {
                    //default case
                    parmName = parms[0].Replace("\"", "");
                    parmType = SqlDbType.VarChar;
                }


                //special metatag cases
                if (parms[1].Equals("*FOLDERWATCHERFILENAME*") && inputData.ContainsKey("FOLDERWATCHERFILENAME"))
                    parmValue = inputData["FOLDERWATCHERFILENAME"].ToString();
				else if (parms[1].Equals( "*NEXT_BUSINESS_DATE*" ))
                    //Replaced legacy ConfigUtils meta tag replacement logic with new MetaTagReplacer
					//parmValue = ConfigUtils.MetaTagReplacer( "*NEXT_BUSINESS_DATE*", DateTime.Today );
                    parmValue = MetaTagReplacer.GetMetaTagValue("*NEXT_BUSINESS_DATE*", 
                                                                                                    ((State)this.ExecutionEngine.GetJobState(this.job.JobName)).CurrentParameters.ProcessInputDates,
                                                                                                    null);
				else
				{
                    //New meta tag replacement logic 
                    //+ (UNUSED ?) substitution of "BUS_" keys with values  - added for backward compatibility
					//parmValue = ConfigUtils.MetaTagReplacer( parms[1].Replace( "\"", "" ), inputData );
					//parmValue = ConfigUtils.MetaTagReplacer( parmValue );
                    parmValue = parms[1].Replace("\"", "");
                    foreach (string key in inputData.Keys)
                    {
                        string metaTag = String.Format("*BUS_{0}*", key);
                        parmValue = parmValue.Replace(metaTag, inputData[key].ToString());
                    }
                    parmValue = MetaTagReplacer.InlineMetatagSubstitution(parmValue,
                                            ((State)this.ExecutionEngine.GetJobState(this.job.JobName)).CurrentParameters.CurrentParameters);
				}

                //special case to put data on bus
                if (parameters.Equals("RunDate"))
                    AddToOutputs("RunDate", parmValue);

                // add parm to collection
                parameters[i] = new SqlParameter(parmName, parmType);
				if (parmType.Equals( SqlDbType.DateTime ) || parmType.Equals( SqlDbType.SmallDateTime ))
				{
					//deal with Geneva formatting before attempting Sql Server call
                    if (parmValue.Length > 10 && parmValue.Substring(10, 1) == ":")
						parmValue = String.Format( "{0} {1}", parmValue.Substring( 0, 10 ), parmValue.Substring( 11, parmValue.Length - 11 ) );

					DateTime pvD = DateTime.MinValue;
					if (DateTime.TryParse( parmValue.ToString(), out pvD ))
						parameters[i].Value = pvD;
				}
				else
					parameters[i].Value = parmValue;
                i++;
            }

            return parameters;
        }
开发者ID:BrianGoff,项目名称:BITS,代码行数:88,代码来源:DbSqlAdapter.cs


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