I want to insert datetime into the database.I want to insert date as a dd/MMMM/yyyy format
SqlDateTime x;
if((TextBox1.Te xt).Length==0)
{
x=SqlDateTime.N ull;
}
else
{
x=DateTime.Pars e(TextBox1.Text );
}
command=sqlConn ection.CreateCo mmand();
command.Command Text="insert into Table2 values('"+x+"') ";
sqlConnection.O pen();
command.Execute NonQuery();
Response.Write( "Save");
when I add this type of dates ex.25/02/2005 it occur error, how can I solve this.
SqlDateTime x;
if((TextBox1.Te xt).Length==0)
{
x=SqlDateTime.N ull;
}
else
{
x=DateTime.Pars e(TextBox1.Text );
}
command=sqlConn ection.CreateCo mmand();
command.Command Text="insert into Table2 values('"+x+"') ";
sqlConnection.O pen();
command.Execute NonQuery();
Response.Write( "Save");
when I add this type of dates ex.25/02/2005 it occur error, how can I solve this.
Comment