TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
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;
}
}
Reply
Answers (
1
)
C# Application runs in Windows 10 but not Windows Vista
Get the value from datagrid to textbox using c#