2 // System.Data.Odbc.OdbcParameter
5 // Brian Ritchie (brianlritchie@hotmail.com)
7 // Copyright (C) Brian Ritchie, 2002
12 using System.Data.Common;
14 namespace System.Data.Odbc
16 public sealed class OdbcParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
26 DataRowVersion sourceVersion;
28 ParameterDirection direction;
38 public OdbcParameter ()
46 sourceColumn = String.Empty;
49 public OdbcParameter (string name, object value)
56 public OdbcParameter (string name, OdbcType dataType)
62 // These paramter types aren't supported yet...
63 if (odbcType==OdbcType.Date || odbcType==OdbcType.Time || odbcType==OdbcType.DateTime ||
64 OdbcType==OdbcType.Timestamp || odbcType==OdbcType.SmallDateTime)
65 throw new NotSupportedException();
68 public OdbcParameter (string name, OdbcType dataType, int size)
69 : this (name, dataType)
74 public OdbcParameter (string name, OdbcType dataType, int size, string srcColumn)
75 : this (name, dataType, size)
77 this.sourceColumn = srcColumn;
80 public OdbcParameter(string name, OdbcType dataType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value)
81 : this (name, dataType, size, srcColumn)
83 this.direction = direction;
84 this.isNullable = isNullable;
85 this.precision = precision;
87 this.sourceVersion = srcVersion;
95 public DbType DbType {
96 get { return dbType; }
102 public ParameterDirection Direction {
103 get { return direction; }
104 set { direction = value; }
107 public bool IsNullable {
108 get { return isNullable; }
111 public OdbcType OdbcType {
112 get { return odbcType; }
118 public string ParameterName {
120 set { name = value; }
123 public byte Precision {
124 get { return precision; }
125 set { precision = value; }
129 get { return scale; }
130 set { scale = value; }
135 set { size = value; }
138 public string SourceColumn {
139 get { return sourceColumn; }
140 set { sourceColumn = value; }
143 public DataRowVersion SourceVersion {
144 get { return sourceVersion; }
145 set { sourceVersion = value; }
148 public object Value {
152 set { this.IntValue =(int) value; }
155 #endregion // Properties
157 #region Internal Properties
159 internal void Bind(IntPtr hstmt,int ParamNum)
161 OdbcReturn ret=libodbc.SQLBindParam(hstmt, Convert.ToInt16(ParamNum), (short) odbcType, (short) odbcType, 0,0,ref IntValue, 0);
162 libodbchelper.DisplayError("SQLBindParam",ret);
165 #endregion // Internal Properties
170 object ICloneable.Clone ()
172 throw new NotImplementedException ();
175 public override string ToString ()
177 return ParameterName;