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

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?
 
G

Guest

 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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top