Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursoradapter sees date type fields as character
Message
De
09/08/2009 11:24:25
 
 
À
09/08/2009 07:37:14
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01416869
Message ID:
01416922
Vues:
56
>>>>SQLexpress 2008, ODBC, Sqlserver Native Client 10.0, VFP9 SP1
>>>>
>>>>a) SQLEXEC(nhandle, "select ....","tempcurs") returns the DATE type fields as Character
>>>>b) When I build a cursoradapter from an SQL table characterizes (translates) the DATE type fields as CHARACTER.
>>>>Is this normal? Is it a bug?
>>>
>>>No, it returns it as a datetime (maybe you have a cursorschema in your class setting it to character?).
>>>Cetin
>>
>>Hi Cetin,
>>
>>a) Why DATETIME, in the table I have difined it as DATE?
>>
>>b) I build the cursorschema as folows:
>>
>>* some code
>>
>>This.CursorSchema=""
>>Afields(aFieldList)
>>Local xcomma, lnI, lcField, lcType, lnWidth, lnDec
>>For lnI =1 To ALEN(aFieldList,1)
>> lcField = aFieldList[lnI, 1]
>> lcType = aFieldList[lnI, 2]
>> lnWidth = aFieldList[lnI, 3]
>> lnDec = aFieldList[lnI, 4]
>> xcomma=Iif(lnI=1,"",",")
>> This.UpdateNameList =This.UpdateNameList + m.xcomma+ lcField+" "+;
>> this.Tables+"."+lcField
>> This.UpdatableFieldList=This.UpdatableFieldList + m.xcomma + lcField
>> Do Case
>> Case Inlist(lcType, [Y], [D], [L], [M], [G], [I], [T] )
>> This.CursorSchema = This.CursorSchema + lcType
>> Case Inlist(lcType, [C], [V])
>> This.CursorSchema = This.CursorSchema + lcType + [(] + Transform(lnWidth) + [)]
>> Case Inlist(lcType, [N], [F])
>> This.CursorSchema = This.CursorSchema + lcType + [(] + Transform(lnWidth) + [,] + Transform(lnDec) + [)]
>> Case Inlist(lcType, [B])
>> This.CursorSchema = This.CursorSchema + lcType + [(] + Transform(lnDec) + [)]
>> Endcase
>>ENDFOR
>>
>>c) Why the same problem in the results of the SQLEXEC statement that cursoradapter is not involved?
>
>
>You are right I should say Date for Date, Datetime for Datetime. If it is returning character type than I suspect you are using an older driver and not {SQL Native Client 10.0}. With that driver I get correct result. See this thread (although it is in Turkish near at the end of thread you would see some sample data creation and query code. The problem was using the old driver).
>
>http://www.fox4um.com/topic/1207/dtos-in-tersi-var-mi-helpde-bulamadim/
>
>Cetin
Thanks Cetin,
You are right. Mistakenly I was using {SQL server} driver instead the {SQL Native Client 10.0}. Some ware in my code I was overwriting the original correct connection with the SQL Native Client 10.0} by the {SQL server}.
Say hello to family.
Yiorgos
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform