Source language: Translate to:

dbpQuery on time field

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

dbpQuery on time field

Postby paeon09 » Wed Nov 06, 2013 5:53 am

Hi all

I have a table with a time field, and in the time field I have a value 08:16 which represents 16 minutes past 8 am, now
I have a variable with this value 08:16 and wish to find the value in the time field.

dbpCreateTable "TM" "user_times" "id AutoInc;user_id Integer;c_date DateTime;n_date Integer;at_on Time;at_off Time;at_time Time"

[usertime] holds 08:16
user_times is my table name
user_times.at_on is my field name

I have tried::
dbpQuery "TM" "user_times" "user_times.at_on = #[usertime]#"
and
dbpQuery "TM" "user_times" "at_on = #[usertime]#"
and
dbpQuery "TM" "user_times" "user_times.at_on = [usertime]"

but I get::
dbpError=Parameter object is improperly defined. Inconsistent or incomplete information was provided

I know its me, but having trouble working it out.

The idea of the table is to have a time in and a time out then calculate the time difference
of the two.

I am not sure if a time field is strictly necessary here?

any help greatly appreciated

Tony
User avatar
paeon09
 
Posts: 4
Joined: Sun Sep 23, 2012 5:54 am

Re: dbpQuery on time field

Postby mishem » Wed Nov 06, 2013 6:01 am

should work

dbpQuery "TM" "user_times" "user_times.at_on = [#34][usertime][#34]"

Or can not return to a variable 08:16 and 8:16.

I have not tested it, just conjecture.
mishem
 
Posts: 574
Joined: Mon Oct 08, 2012 1:51 pm

Re: dbpQuery on time field

Postby Gaev » Wed Nov 06, 2013 6:19 am

paeon09:

If your database is of the MS Access kind, note this information in the Help file related to dbpCreateTable ...
Time Time. This type is not supported by MS Access, use DateTime instead.**


If you need to query "time of day" in your application, consider storing it in an Integer field with a value representing "minutes from midnight" e.g. 8:16 (am) would be stored (and queried) as 496.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: dbpQuery on time field

Postby Neosoft Support » Wed Nov 06, 2013 12:28 pm

You may have to format the time in a specific way. For example:

SetVar "[usertime]" "8:00:00 AM"

Then perform a query like this:

dbpQuery "TM" "user_times" "at_on = #[usertime]#"
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: dbpQuery on time field

Postby paeon09 » Thu Nov 07, 2013 4:48 am

Many thanks everyone

Gaev was spot on, I was using a access db(did not rtfm) also used your suggestion Gaev
to use int field with mins from midnight, thank you.

Tony
User avatar
paeon09
 
Posts: 4
Joined: Sun Sep 23, 2012 5:54 am


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 3 guests