Exemplo n.º 1
0
		public SqlParameter (string parameterName, SqlDbType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) 
		{
			if (parameterName == null)
				parameterName = string.Empty;

			metaParameter = new TdsMetaParameter (parameterName, size, 
							      isNullable, precision, 
							      scale,
							      GetFrameworkValue);
			metaParameter.RawValue =  value;
			if (dbType != SqlDbType.Variant) 
				SqlDbType = dbType;
			Direction = direction;
			SourceColumn = sourceColumn;
			SourceVersion = sourceVersion;
		}
Exemplo n.º 2
0
		private string FormatParameter (TdsMetaParameter parameter)
		{
			if (parameter.Direction == TdsParameterDirection.Output)
				return String.Format ("{0} output", parameter.ParameterName);
		
			if (parameter.Value == null || parameter.Value == DBNull.Value)
				return "NULL";
		
			switch (parameter.TypeName) {
			case "smalldatetime":
			case "datetime":
				DateTime d = (DateTime)parameter.Value;
				return String.Format(System.Globalization.CultureInfo.InvariantCulture, 
						     "'{0:MMM dd yyyy hh:mm:ss tt}'", d );
			case "bigint":
			case "decimal":
			case "float":
			case "int":
			case "money":
			case "real":
			case "smallint":
			case "smallmoney":
			case "tinyint":
				return parameter.Value.ToString ();
			case "nvarchar":
			case "nchar":
				return String.Format ("N'{0}'", parameter.Value.ToString ().Replace ("'", "''"));
			case "uniqueidentifier":
				return String.Format ("0x{0}", ((Guid) parameter.Value).ToString ("N"));
			case "bit":
				if (parameter.Value.GetType () == typeof (bool))
					return (((bool) parameter.Value) ? "0x1" : "0x0");
				return parameter.Value.ToString ();
			case "image":
			case "binary":
			case "varbinary":
				return String.Format ("0x{0}", BitConverter.ToString ((byte[]) parameter.Value).Replace ("-", string.Empty).ToLower ());
			default:
				return String.Format ("'{0}'", parameter.Value.ToString ().Replace ("'", "''"));
			}
		}
Exemplo n.º 3
0
		public SqlParameter (string parameterName, object value)
		{
			if (parameterName == null)
				parameterName = string.Empty;
			metaParameter = new TdsMetaParameter (parameterName, GetFrameworkValue);
			metaParameter.RawValue = value;
			InferSqlType (value);
			sourceVersion = DataRowVersion.Current;
		}
		public SybaseParameter (string parameterName, object value) 
		{
			metaParameter = new TdsMetaParameter (parameterName, value);
			this.sourceVersion = DataRowVersion.Current;
			InferSybaseType (value);
		}
		public SybaseParameter (string parameterName, SybaseType dbType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value) 
		{
			metaParameter = new TdsMetaParameter (parameterName, size, isNullable, precision, scale, value);

			SybaseType = dbType;
			Direction = direction;
			SourceColumn = sourceColumn;
			SourceVersion = sourceVersion;
		}
Exemplo n.º 6
0
		public int IndexOf (TdsMetaParameter value)
		{
			return list.IndexOf (value);
		}
Exemplo n.º 7
0
		public SqlParameter (string parameterName, object value) 
		{
			metaParameter = new TdsMetaParameter (parameterName, SqlTypeToFrameworkType (value));
			this.sourceVersion = DataRowVersion.Current;
			InferSqlType (value);
		}
Exemplo n.º 8
0
		public int Add (TdsMetaParameter value)
		{
			return list.Add (value); 
		}
Exemplo n.º 9
0
		public bool Contains (TdsMetaParameter value)
		{
			return list.Contains (value);
		}
Exemplo n.º 10
0
		public void Insert (int index, TdsMetaParameter value)
		{
			list.Insert (index, value);
		}
Exemplo n.º 11
0
		public void Remove (TdsMetaParameter value)
		{
			list.Remove (value);
		}
Exemplo n.º 12
0
 public void Insert(int index, TdsMetaParameter value)
 {
     list.Insert(index, value);
 }
Exemplo n.º 13
0
 public int IndexOf(TdsMetaParameter value)
 {
     return(list.IndexOf(value));
 }
Exemplo n.º 14
0
 public bool Contains(TdsMetaParameter value)
 {
     return(list.Contains(value));
 }
Exemplo n.º 15
0
 public int Add(TdsMetaParameter value)
 {
     return(list.Add(value));
 }
Exemplo n.º 16
0
 public void Remove(TdsMetaParameter value)
 {
     list.Remove(value);
 }