I am trying to submit a time stamp with this insert statement, but am getting a SQL datatype error on the variable "moddate." The sql table datatype is datetime and I'm assuming I'm getting the error b/c I'm sending a string. What's the best way to send a timestamp using a text command like below. This is simple using stored procedures unfortunately sp's are not part of the requirement and I'm not as familiar with in-line queries.
DateTime myDate = new DateTime();
string moddate = myDate.Date.ToString();
try
{
using( SqlConn )
{
SqlConn = new System.Data.SqlClient.SqlConnection();
SqlConn.ConnectionString = System.Configuration.ConfigurationSettings.AppSett ings["TAO_FORM_DB"];
commandText = "INSERT INTO TAO_Form" +
"( Name, Subject, isActive, Owner, OwnerDepartment, DateCreated, DateModified, LastModifiedUser, Topic, FromAddress, DefaultToRecipients, DefaultCCRecipients, DefaultBCCRecipients, FormText) "
+ "VALUES( ' " + strformName + " ', ' " + strSubject + " ', 1, ' " + strOwner + " ', ' " + strOwnerDepartment + " ', ' " + moddate + " ', ' " + moddate + " ', " + strlastModifiedUser + " ', ' " + strTopic + " ', ' " + strFromAddress+ " ', ' " + strDefaultToRecipients + " ', ' " + strDefaultCCRecipients + " ', ' " + strDefaultBCCRecipients + " ', ' " + strFormText + " ' )";
Cmd_TAO_InsertForm = new SqlCommand(commandText, SqlConn);
SqlConn.Open();
Cmd_TAO_InsertForm.ExecuteNonQuery();
}