<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
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();
}
}