Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #728

Re: Opening Date columns

From "Willie Moore" <williem@wmconsulting.com>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Opening Date columns
Date 2011-04-06 12:28 -0500
Organization Aioe.org NNTP Server
Message-ID <ini7rv$57m$1@speranza.aioe.org> (permalink)
References <oBGmp.928$K4.267@news.indigo.ie> <4d9b8ed4$0$11191$c30e37c6@exi-reader.telstra.net> <TcWmp.929$K4.384@news.indigo.ie> <inhnsn$s3h$1@speranza.aioe.org> <RY%mp.932$K4.423@news.indigo.ie>

Show all headers | View raw


Kevin,

I thought we were talking about VO that is why I made the statement that I 
did. BTW I have VN2ADO and it works fine with Vulcan 2. I do not use VN2ADO 
for any new work but it is great for my legacy code. When I read in data 
from ADO.Net, I usually do something like this to make sure that it doesn’t 
cause a runtime error:
        LOCAL oDate as DateTime
        LOCAL cDate := "04/01/2011" as String // us date format
        if DateTime.TryParse(cDate,oDate)
           // do something
        else
           // handle error
        endif
You can also do this oDate := DateTime.Parse(cDate)
If you are reading out of an SQL table, you can do something like this:
    oDate := (datetime)oRow:Item["reg_date"]    // this coms in from SQL as 
an object so you have to cast
    oDate := Convert.ToDateTimeoRow:Item["reg_date"])

Regards,
Willie

"Kevin"  wrote in message news:RY%mp.932$K4.423@news.indigo.ie...

Willie,

I am not using VO2ADO as it is not a VO app. I have Vn2ADO for Vulcan 1 but
don't know if if exists for Vulcan 2. There has been some discussion about
it in the past and I have heard nothing to say there was an update. I think
some people have got it to work but I would not be confident to try that
myself.

Kevin


"Willie Moore"  wrote in message news:inhnsn$s3h$1@speranza.aioe.org...

Kevin,

If you are using VO2ADO, the recordset will return a VO date or an
ADODateTime object depending the ADODateTimeAdDate function. Set it to FALSE
at the beginning of your app to always return datetime objects instead of VO
date.

Regards,
Willie

"Kevin"  wrote in message news:TcWmp.929$K4.384@news.indigo.ie...

Geoff,

> It is a VO app so I have chosen to display the date as a VO date using the 
> current regional settings.

I was not certain whether it was the way you chose to interpret the date
columns or there was something you were doing in the SQL that I was missing.

> Same deal. They have to format it some way and they chose that way. But 
> you can display and use the date in any format you wish or add an 
> expression column to the dataset to show it another way.

This I understand and was looking for some way of changing the way the value
was getting returned. I had a look around the MSDN help and could find info
on what column types were available. What I could not find was how to get
the date column returned as a DateTime object rather than a String.

> Of course there is. Do you have a T-SQL book? Just look at date formats. 
> There is a whole table of them to return the value back in a multitude of 
> ways.

Simple answer, no I don't have a T-SQL book. Can you suggest any?
The only way that I could find to get the date column to return a date
rather than a string was a CAST. For example:
--> SELECT ClaimID, CAST(PurchaseDate as date) as PurDate From Purchases

The code runs and the columns display but unfortunately the PurchaseDate is
still a String. I'm probably missing something.

I think I have found a way to get what I am after. That is to create a
DataTable first with a DateTime field and then fill it from an
OleDbDataAdapter. In my original post I had been thinking that the issue may
have been with my lack of understanding of SQL and that the solution might
be there.

Kevin 

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Opening Date columns "Kevin" <kdmurphy@eircom.net> - 2011-04-05 16:31 +0100
  Re: Opening Date columns "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-04-05 21:51 +0000
    Re: Opening Date columns "Kevin" <kdmurphy@eircom.net> - 2011-04-06 10:17 +0100
      Re: Opening Date columns "Willie Moore" <williem@wmconsulting.com> - 2011-04-06 07:55 -0500
        Re: Opening Date columns "Kevin" <kdmurphy@eircom.net> - 2011-04-06 16:50 +0100
          Re: Opening Date columns "Willie Moore" <williem@wmconsulting.com> - 2011-04-06 12:28 -0500
            Re: Opening Date columns "Kevin" <kdmurphy@eircom.net> - 2011-04-07 08:30 +0100
              Re: Opening Date columns "Willie Moore" <williem@wmconsulting.com> - 2011-04-07 09:53 -0500
                Re: Opening Date columns "Kevin" <kdmurphy@eircom.net> - 2011-04-07 16:51 +0100
                Re: Opening Date columns "Willie Moore" <williem@wmconsulting.com> - 2011-04-07 11:08 -0500
      Re: Opening Date columns "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-04-07 22:28 +0000
        Re: Opening Date columns "Kevin" <kdmurphy@eircom.net> - 2011-04-08 17:06 +0100
          Re: Opening Date columns "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-04-09 09:29 +0000

csiph-web