示例#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;
		}
示例#2
0
文件: Tds50.cs 项目: nlhepler/mono
		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 ("'", "''"));
			}
		}
示例#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;
		}
		public int IndexOf (TdsMetaParameter value)
		{
			return list.IndexOf (value);
		}
		public SqlParameter (string parameterName, object value) 
		{
			metaParameter = new TdsMetaParameter (parameterName, SqlTypeToFrameworkType (value));
			this.sourceVersion = DataRowVersion.Current;
			InferSqlType (value);
		}
		public int Add (TdsMetaParameter value)
		{
			return list.Add (value); 
		}
		public bool Contains (TdsMetaParameter value)
		{
			return list.Contains (value);
		}
		public void Insert (int index, TdsMetaParameter value)
		{
			list.Insert (index, value);
		}
		public void Remove (TdsMetaParameter value)
		{
			list.Remove (value);
		}
示例#12
0
 public void Insert(int index, TdsMetaParameter value)
 {
     list.Insert(index, value);
 }
示例#13
0
 public int IndexOf(TdsMetaParameter value)
 {
     return(list.IndexOf(value));
 }
示例#14
0
 public bool Contains(TdsMetaParameter value)
 {
     return(list.Contains(value));
 }
示例#15
0
 public int Add(TdsMetaParameter value)
 {
     return(list.Add(value));
 }
 public void Remove(TdsMetaParameter value)
 {
     list.Remove(value);
 }