How to set sqlite date to calender control ?

kalmenchia

Member
Licensed User
Longtime User
Hi,


I read the sqlite3 order table and there is a field "order_date" defined as datetime.

dataset.CommandText = "select order_date ,order_no,name, description," & _
" from mcrm_order "

1. should i specify my order_date as date(order_date) in sql statement ?
2. how can i get the value and assign it to Calender control ?

I have tried this but it said that

OrderDateCalenderControl.Value = datasource.GetValue(0)

input string was not in a correct format Error!
Can anyone help ? Thanks.

Best Regards,
kalmen
 

kalmenchia

Member
Licensed User
Longtime User
Hi ,


I got the answer ,

**pls take note that my sqlite table , order field type is datetime
** and the date is saved as "yyyy-mm-dd hh:mm:ss" 24 hours format.
** and my sql statement must use the sqlite function to convert the
** datetimestr to date , i.e.select date(order_date) ,.... from order
** then in my basic4ppc code as follow :

DateFormat("yyyy-mm-dd")
OrderDateStr = datasource.GetValue(0) '0 is my order_date field
Order.edOrderDate.Value = DateParse( OrderDateStr )

HTH. Thanks.
 

Picard

Member
Licensed User
Longtime User
I use this lines to set de date on calendar:

DateFormat("yyyy-mm-dd")
Tics=DateParse (Campo1.text)
Calendar1.Value=Tics

Campo1.text is the date read from your database.

I hope this could help you.
 
Top