Cannot format System.String to DateTime when using Oracle.DataAccess.Client with ObjDatasource

Discussion in 'ASP .Net' started by Patrick.O.Ige, Jul 17, 2008.

  1. I have a simple textbox control

    <asp:TextBox ID="calendar" runat="server" CssClass="textbox"></asp:TextBox>


    ( Would be changing it to a calendar control) on a page .I want the user to
    type in a date e.g 2/06/2008 and
    hit submit

    The parameter is being sent to an oracle Db.
    My select statement looks like below:

    Select dt,a,b from Mytable where (to_char(DT, 'D/MM/YYYY') LIKE conc:)pdt)

    My Control Parameter looks like below
    <asp:ControlParameter ControlID="calendar" Name="pdt" PropertyName="Text"
    Type="String" />


    I have tried to format the date string like below:

    but no luck


    String.Format("{0:D/MM/YYY},calendar.text.ToString())
    and added the parameter in the ObjectDataSource_Selecting event but no
    LUCK.

    Any ideas?
     
    Patrick.O.Ige, Jul 17, 2008
    #1
    1. Advertisements

  2. Re: Cannot format System.String to DateTime when usingOracle.DataAccess.Client with ObjDatasource

    On Jul 17, 2:40 pm, "Patrick.O.Ige" <> wrote:
    >  I have a simple textbox control
    >
    > <asp:TextBox ID="calendar" runat="server" CssClass="textbox"></asp:TextBox>
    >
    > ( Would be changing it to a calendar control) on a page .I want the user to
    > type in a date e.g 2/06/2008 and
    >  hit submit
    >
    >  The parameter is being sent to an oracle Db.
    >  My select statement looks like below:
    >
    >  Select dt,a,b from Mytable where (to_char(DT, 'D/MM/YYYY') LIKE conc:)pdt)
    >
    >   My Control Parameter looks like below
    >  <asp:ControlParameter ControlID="calendar" Name="pdt" PropertyName="Text"
    >                     Type="String" />
    >
    > I have tried to format the date string like below:
    >
    > but no luck
    >
    > String.Format("{0:D/MM/YYY},calendar.text.ToString())
    >  and added the parameter in the ObjectDataSource_Selecting event but no
    > LUCK.
    >
    > Any ideas?


    This format could be a problem: String.Format("{0:D/MM/
    YYY},calendar.text.ToString())

    Correct to YYYY (4 times Y) and try again. If it's still not working
    try to debug and check what do you get after the String.Format was
    applied.
     
    Alexey Smirnov, Jul 19, 2008
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?c2Ft?=
    Replies:
    0
    Views:
    1,974
    =?Utf-8?B?c2Ft?=
    Jan 12, 2006
  2. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    1,032
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  3. GaryDean

    Binding ObjdataSource to Gridview

    GaryDean, Jul 25, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    7,026
    Walter Wang [MSFT]
    Jul 31, 2006
  4. mp
    Replies:
    1
    Views:
    667
    John Machin
    Jul 28, 2006
  5. Martin
    Replies:
    0
    Views:
    629
    Martin
    Dec 27, 2008
  6. Replies:
    2
    Views:
    1,052
    M.-A. Lemburg
    Jan 6, 2009
  7. NiklasRTZ

    datetime.datetime. or datetime. ?

    NiklasRTZ, Oct 8, 2009, in forum: Python
    Replies:
    10
    Views:
    748
    niklasr
    Oct 11, 2009
  8. Feyruz
    Replies:
    4
    Views:
    3,060
    Sherm Pendley
    Oct 14, 2005
Loading...