0

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...............

Edited by alam14_mist: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by debasisdas
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.