TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
nirjharini pradhan
NA
94
22.5k
conversion of asp.net Date to oracle date.
Feb 11 2016 12:52 AM
i m trying to insert the date from my textbox to oracle table.But it showing error invalid month please check my code...
jscode:----
<script>
$(function () {
$("#TextBox2").datepicker();
});
aspx:------
<div>
Name:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
Date:
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<br />
</div>
aspx.cs:---------------
using System.Data;
using System.Data.OracleClient;
using System.Configuration;
public partial class TestDate : System.Web.UI.Page
{
OracleConnection cn = null;
protected void Page_Load(object sender, EventArgs e)
{
cn = new OracleConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
}
protected void Button1_Click(object sender, EventArgs e)
{
string query = "insert into DateDemo(NAME,TODAY)values('"+TextBox1.Text+"',"+DateTime.ParseExact(TextBox2.Text,"dd/mon/yyyy",null)+")";
OracleCommand cmd = new OracleCommand(query,cn);
if (cn.State != ConnectionState.Open)
cn.Open();
int affect = cmd.ExecuteNonQuery();
if (affect > 0)
Response.Write("success");
cn.Close();
}
}
Thanks In Advance
Reply
Answers (
17
)
HTTPContext.current not resolved
Avoid pop-up blocker settings when opening new Window.