public ParameterMeta(string strParamName, DataTypeEnum enumDataType, ParameterDirectionEnum enumDirection, IDataTypeDictionary typeMap) : base(strParamName, enumDataType, typeMap) { _eDirection = enumDirection; }
internal Parameter(string name, ParameterDirectionEnum direction = ParameterDirectionEnum.InOut, bool nillable = true, string documentation = "") { Name = name; Nillable = nillable; ParameterDirection = direction; Documentation = documentation; }
internal Parameter(XmlSchemaElement element, ParameterDirectionEnum direction, XdtoFactory factory) { Name = element.Name; Nillable = element.IsNillable; ParameterDirection = direction; Documentation = ""; if (element.SchemaType is XmlSchemaSimpleType) { Type = new XdtoValueType(element.SchemaType as XmlSchemaSimpleType, factory); } else if (element.SchemaType is XmlSchemaComplexType) { Type = new XdtoObjectType(element.SchemaType as XmlSchemaComplexType, factory); } else { if (element.SchemaTypeName != null) { Type = factory.Type(element.SchemaTypeName.Namespace, element.SchemaTypeName.Name); } } }
/// <summary> /// Adds a parameter to the specified command object using the specified parameters. /// </summary> /// <param name="oADOCommand">Command to which to add the parameter</param> /// <param name="parameterType">Data type for the parameter</param> /// <param name="varParameterValue">Value for the parameter</param> /// <param name="parameterDirection">Direction of the parameter - In, Out, In/Out</param> /// <param name="parameterName">Name of the parameter</param> /// <returns>Boolean indicating status</returns> private bool AddParameterToCommand(Command oADOCommand, DataTypeEnum parameterType, object varParameterValue, ParameterDirectionEnum parameterDirection, string parameterName) { bool returnValue = false; try { Parameter oParameter = default(Parameter); Command adoCommand = oADOCommand; oParameter = adoCommand.CreateParameter(); oParameter.Direction = parameterDirection; if (parameterName.Length > 0) { oParameter.Name = parameterName; } oParameter.Type = parameterType; if (oParameter.Type == DataTypeEnum.adChar | oParameter.Type == DataTypeEnum.adVarChar) { if (Convert.IsDBNull(varParameterValue) || (string)varParameterValue == string.Empty) { oParameter.Size = 1; } else { oParameter.Size = Convert.ToInt32(varParameterValue.ToString().Length); } } if (Convert.IsDBNull(varParameterValue) || varParameterValue.ToString() == string.Empty) { Object adParamNullable = null; oParameter.Attributes = Convert.ToInt32(adParamNullable); oParameter.Direction = ParameterDirectionEnum.adParamInput; oParameter.Value = DBNull.Value; } else { oParameter.Value = varParameterValue; } adoCommand.Parameters.Append(oParameter); oParameter = null; returnValue = true; } catch (Exception ex) { if (m_InteractiveMode) { MessageBox.Show(m_Application.ApplicationWindow, TRACE_ADD_PARAMETER_ERROR + ": " + ex.Message, ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } WriteToCommandLog("ERROR", TRACE_ADD_PARAMETER_ERROR + ": " + ex.Message, "commonTraceHelper.AddParameterToCommand"); returnValue = false; } return(returnValue); }