I have a program with the following code:
UniQuery.SQL.Text := 'select * from Test';
UniQuery.Open;
for i := 0 to UniQuery.FieldCount - 1 do
Memo.Lines.Add (IntToStr(i) + ' ' +
UniQuery.Fields.FieldName + ' ' +
GetEnumName(TypeInfo(TFieldType),Ord(UniQuery.Fields.DataType)));
With NetworkLibrary set to prNativeClient (or prAuto) I get the following result:
0 IntColumn ftInteger
1 VarCharColumn ftString
2 DateTimeColumn ftDateTime
3 SmallDateTimeColumn ftDateTime
4 DateColumn ftDate
With NetworkLibrary set to prSQL I get the following result:
0 IntColumn ftInteger
1 VarCharColumn ftString
2 DateTimeColumn ftDateTime
3 SmallDateTimeColumn ftDateTime
4 DateColumn ftWideString
The date column has changed from ftDate to ftWideString. Is this a bug (or feature !) in the Microsoft libraries and if so is there a work around ?
SQL Server Date field and NetworkLibrary
Re: SQL Server Date field and NetworkLibrary
The point is that the standard OLEDB provider processes date fields as string fields. If you need to map the date data type to ftDdate, you can use Data Type Mapping. For example, in the dataset before opening it:
More details about Data Type Mapping can be found in our documentation: http://www.devart.com/unidac/docs/index ... apping.htm .
Code: Select all
UniQuery.DataTypeMap.AddFieldNameRule('DateColumn', ftDate);-
JimMellish
- Posts: 8
- Joined: Wed 06 Mar 2013 21:48
Re: SQL Server Date field and NetworkLibrary
I think we will have to insist that NativeClient is used. We have too many queries, with some of them being generated automatically, to apply data type mapping to every query with a date in its result set.
Re: SQL Server Date field and NetworkLibrary
Yes, in your case, it is better to use NativeClien.