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
Ranjit PowarRank #553 · 4.4K reputationPosted Feb 11, 2016, 2:33 AM EST
Shubham KumarRank #621 · 3.8K reputationPosted Feb 10, 2016, 11:50 PM EST
to_dateto convert date.nirjharini pradhan94 reputationPosted Feb 11, 2016, 1:35 AM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 1:37 AM EST
Ranjit PowarRank #553 · 4.4K reputationPosted Feb 11, 2016, 1:46 AM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 1:54 AM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 1:57 AM EST
DD-Mon-YYYY'.like this i want to insert.please suggest me some solution.Ranjit PowarRank #553 · 4.4K reputationPosted Feb 11, 2016, 2:06 AM EST
Shubham KumarRank #621 · 3.8K reputationPosted Feb 11, 2016, 2:11 AM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 2:13 AM EST
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Ranjit PowarRank #553 · 4.4K reputationPosted Feb 11, 2016, 2:21 AM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 2:26 AM EST
inconsistent datatypes: expected DATE got NUMBER
please help me to resolve this errorRanjit PowarRank #553 · 4.4K reputationPosted Feb 11, 2016, 2:30 AM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 2:30 AM EST
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
nirjharini pradhan94 reputationPosted Feb 11, 2016, 6:57 PM EST
Ranjit PowarRank #553 · 4.4K reputationPosted Feb 11, 2016, 7:43 PM EST
nirjharini pradhan94 reputationPosted Feb 11, 2016, 7:46 PM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts