anil wagavkar

anil wagavkar

  • NA
  • 13
  • 5.6k

insertind date problem

Mar 24 2016 1:00 AM
when i insert date in database using calenderextender i have error 
 
 "Incorrect syntax near '24-03-2016 00:00:00'. "
 
  my code.
 
protected void Button2_Click(object sender, EventArgs e)
{
 DateTime? joingdate;
 joingdate = DateTime.ParseExact(joing.Text, "dd/MM/yyyy",null);
SqlCommand cmd = new SqlCommand("insert into acmaster(Name,Addr1,Mobile,Emailid,Panno,Nominee,Relation,Sponcerid,Sponcustno,Itemcode,Itemprice,commission,joing)values('" + customer.Text + "','" + adderss.Text + "','" + mobile.Text + "','" + emailid.Text + "','" + panno.Text + "','" + nomineen.Text + "','" + nomineer.Text + "','" + rankcode.Text + "','" + custno.Text + "','" + productid.Text + "','" + prize.Text + "','"+commission.Text+"'.'"+d+"')", con);
cmd.CommandType = CommandType.Text;
try
{
con.Open();
cmd.ExecuteNonQuery();
// Label25.Text = "data Inserted";
Response.Write("<script>alert('Data Save....')</script>");
con.Close();
clearfield();
}
catch (Exception ex)
{
Label25.Text = ex.Message;
}
}
 

Answers (1)