To Rick Lipkin for problem with ADO and BCC582

To Rick Lipkin for problem with ADO and BCC582

Postby jcaro » Wed Apr 04, 2012 7:48 pm

Hello Rick:

I am writing to see if you have any solution to the problem of dates "T" time, when consulting with ADO to MSSQL server.

My problem is that I do a query returns erroneous data types.

For example:
Code: Select all  Expand view



       ? oRs:Fields("FechaEmision"):Value               ==>  return blank fields  from  BD

       ?  Valtype( oRs:Fields("FechaEmision"):Value )      ==>  return  T            (   I think Time type  )

       ?  Dtoc( oRs:Fields("FechaEmision"):Value )         ==>  04-04-2012  ,  show how character type

 



I have read your queries, but not if you have any solution?

I am using BCC582 + the last build of xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 9445).

Any idea as you're doing ?

JC
Juan
==> Pasando a FWH16.04 + Harbour32 + BCC70 + PellesC
=> Abandonando FWH 13.7 + xHarbour + BCC582
http://www.mitaller.cl
jcaro
 
Posts: 270
Joined: Fri Nov 11, 2005 7:39 pm

Re: To Rick Lipkin for problem with ADO and BCC582

Postby Rick Lipkin » Wed Apr 04, 2012 8:47 pm

Juan

DateTime field types now return a valtype of "T" rather than "D" in xHarbour. I know this is now an inconvenience and when displaying your ADO date in your forms you do not get just a date ..

The fixes the xHarbour developers made was to keep the backward compatability in comparing values, adding and subtracting and writing the datetime back to the SQL table correctly.

Again, the biggest change is your DateTime values are a new valtype "T" and not considered "D" any longer.

The workaround was mentioned earlier in this forum and this user defined function takes a datetime back to valtype "D" ..

Code: Select all  Expand view

xCreateDate := oRsUser:Fields("CreateDate"):Value

? " "
? "xCreatedate from table after Get"
? xCreateDate
? xCreateDate := ttodate( xCreateDate )
? ValType( xCreateDate )
Wait

Return(nil)

//--------------------------
function ttodate( tDate )
return( stod( substr( ttos( tDate ), 1, 8 ) ))

 


Image
User avatar
Rick Lipkin
 
Posts: 2629
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Rick Lipkin for problem with ADO and BCC582

Postby jcaro » Wed Apr 04, 2012 11:01 pm

Hello Rick:

Many thanks for your soon answers and time.

I expect another solution, but it's reassuring to know
string manipulations to dates he was doing,
were the best solution for the moment, I was doing.

JC
Juan
==> Pasando a FWH16.04 + Harbour32 + BCC70 + PellesC
=> Abandonando FWH 13.7 + xHarbour + BCC582
http://www.mitaller.cl
jcaro
 
Posts: 270
Joined: Fri Nov 11, 2005 7:39 pm

Re: To Rick Lipkin for problem with ADO and BCC582

Postby Rick Lipkin » Thu Apr 05, 2012 12:19 pm

Juan

It appears we must embrace the valtype "T" for Datetime... at least you can treat DateTime as you did valtype "D" as far as adding, subtracting values of datetime as well as datetime comparisons.. and then writing the datetime back to the SQL table.

The only inconvenience is how datetime shows in your current dialogs and forms. Build 9444 allows you to work with datetime as you did dates .. and that was the bug the developers recently fixed in xHarbour.

Rick
User avatar
Rick Lipkin
 
Posts: 2629
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Rick Lipkin for problem with ADO and BCC582

Postby jcaro » Thu Apr 05, 2012 8:38 pm

Rick ,

OK, thanks for this new info.

JC
Juan
==> Pasando a FWH16.04 + Harbour32 + BCC70 + PellesC
=> Abandonando FWH 13.7 + xHarbour + BCC582
http://www.mitaller.cl
jcaro
 
Posts: 270
Joined: Fri Nov 11, 2005 7:39 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 16 guests