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

  • Thread starter Thread starter Patrick.O.Ige
  • Start date Start date
P

Patrick.O.Ige

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?
 
 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.
 
Back
Top