i m trying to insert the date from my textbox to oracle table.But it showing error invalid month please check my code...
jscode:----
$(function () {
$("#TextBox2").datepicker();
});
aspx:------ Name:
Date:
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
17 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ranjit PowarPosted Feb 11, 2016, 7:33 AM
nirjharini pradhanPosted Feb 12, 2016, 12:46 AM
Ranjit PowarPosted Feb 12, 2016, 12:43 AM
nirjharini pradhanPosted Feb 11, 2016, 11:57 PM
nirjharini pradhanPosted Feb 11, 2016, 7:30 AM
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Ranjit PowarPosted Feb 11, 2016, 7:30 AM
nirjharini pradhanPosted Feb 11, 2016, 7:26 AM
inconsistent datatypes: expected DATE got NUMBER
please help me to resolve this errorRanjit PowarPosted Feb 11, 2016, 7:21 AM
nirjharini pradhanPosted Feb 11, 2016, 7:13 AM
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Shubham KumarPosted Feb 11, 2016, 7:11 AM
Ranjit PowarPosted Feb 11, 2016, 7:06 AM
nirjharini pradhanPosted Feb 11, 2016, 6:57 AM
DD-Mon-YYYY'.like this i want to insert.please suggest me some solution.nirjharini pradhanPosted Feb 11, 2016, 6:54 AM
Ranjit PowarPosted Feb 11, 2016, 6:46 AM
nirjharini pradhanPosted Feb 11, 2016, 6:37 AM
nirjharini pradhanPosted Feb 11, 2016, 6:35 AM
Shubham KumarPosted Feb 11, 2016, 4:50 AM
to_dateto convert date.