How to set sqlite date to calender control ?

Discussion in 'Questions (Windows Mobile)' started by kalmenchia, Sep 3, 2009.

  1. kalmenchia

    kalmenchia Member Licensed 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
     
  2. kalmenchia

    kalmenchia Member Licensed 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.
     
  3. Picard

    Picard Member Licensed 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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice