1
1
using System ;
2
2
using System . Data . Common ;
3
3
using System . Text ;
4
- using System . Threading ;
5
- using System . Threading . Tasks ;
6
4
7
5
namespace System . Data . Jet
8
6
{
@@ -106,7 +104,15 @@ public override decimal GetDecimal(int ordinal)
106
104
107
105
public override double GetDouble ( int ordinal )
108
106
{
109
- return Convert . ToDouble ( _wrappedDataReader . GetValue ( ordinal ) ) ;
107
+ object value = _wrappedDataReader . GetValue ( ordinal ) ;
108
+ if ( value is string )
109
+ {
110
+ byte [ ] buffer = Encoding . Unicode . GetBytes ( ( string ) value ) ;
111
+ double doubleValue = BitConverter . ToDouble ( buffer , 0 ) ;
112
+ return doubleValue ;
113
+ }
114
+ else
115
+ return Convert . ToDouble ( _wrappedDataReader . GetValue ( ordinal ) ) ;
110
116
}
111
117
112
118
public override System . Collections . IEnumerator GetEnumerator ( )
@@ -121,7 +127,15 @@ public override Type GetFieldType(int ordinal)
121
127
122
128
public override float GetFloat ( int ordinal )
123
129
{
124
- return Convert . ToSingle ( _wrappedDataReader . GetValue ( ordinal ) ) ;
130
+ object value = _wrappedDataReader . GetValue ( ordinal ) ;
131
+ if ( value is string )
132
+ {
133
+ byte [ ] buffer = Encoding . Unicode . GetBytes ( ( string ) value ) ;
134
+ float singleValue = BitConverter . ToSingle ( buffer , 0 ) ;
135
+ return singleValue ;
136
+ }
137
+ else
138
+ return Convert . ToSingle ( _wrappedDataReader . GetValue ( ordinal ) ) ;
125
139
}
126
140
127
141
public override Guid GetGuid ( int ordinal )
@@ -188,7 +202,7 @@ public override T GetFieldValue<T>(int ordinal)
188
202
if ( typeof ( T ) == typeof ( TimeSpan ) )
189
203
return ( T ) ( object ) GetTimeSpan ( ordinal ) ;
190
204
else if ( typeof ( T ) == typeof ( DateTimeOffset ) )
191
- return ( T ) ( object ) GetDateTimeOffset ( ordinal ) ;
205
+ return ( T ) ( object ) GetDateTimeOffset ( ordinal ) ;
192
206
else
193
207
return base . GetFieldValue < T > ( ordinal ) ;
194
208
}
0 commit comments