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. Advertising

  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. Advertising

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. gencode
    Replies:
    0
    Views:
    609
    gencode
    Dec 27, 2005
  2. =?Utf-8?B?c2Ft?=
    Replies:
    0
    Views:
    1,741
    =?Utf-8?B?c2Ft?=
    Jan 12, 2006
  3. =?Utf-8?B?dmE=?=
    Replies:
    1
    Views:
    346
    Karl Seguin [MVP]
    Feb 22, 2006
  4. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    691
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  5. GaryDean

    Binding ObjdataSource to Gridview

    GaryDean, Jul 25, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    6,790
    Walter Wang [MSFT]
    Jul 31, 2006
Loading...

Share This Page