I have declared the datatyp of 'p_date' as datetime
I have also used DateTextBox_CalenderExtender on textbox.(from Ajax ToolKit)
DateTime datetime=new DateTime();
datetime=convert.ToDateTime(DateTextBox.text);
InsertIntoMrNo(mrNoTextBox.Text, datetime, postIdTextBox.Text);
public void InsertIntoMrNo(string mrno, DateTime mrdate, string postid)
{
connection =ConfigurationManager.AppSettings["ConnectionString"];
sqlConnectionObj = new SqlConnection(connection);
insertQuery = @"INSERT INTO mrno (mr_no,p_date,post_id)
VALUES('" + mrno+"', '" + mrdate + "' ,'" + postid + "')";
sqlConnectionObj.Open();
sqlCommandObj = new SqlCommand(insertQuery, sqlConnectionObj);
sqlCommandObj.ExecuteNonQuery();
}
error message is :The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. The statement has been terminated.
Please help.
Thanks to all...............