DataAccessLayer.DataBase.CreateComment C# (CSharp) Method

CreateComment() public method

public CreateComment ( Comment comment ) : bool
comment Entities.Comment
return bool
        public bool CreateComment(Comment comment)
        {
            var queryString =
                "INSERT INTO [dbo].comments ([dbo].comments.comid, [dbo].comments.createdtime, [dbo].comments.accountid, [dbo].comments.postid, [dbo].comments.name, [dbo].comments.text) " +
                "VALUES (@comid, @createdtime, @accountid, @postid, @name, @text);";

            using (SqlConnection connection = new SqlConnection(_connectionString))
            {
                var command = new SqlCommand(queryString, connection);

                command.Parameters.AddWithValue("comid", comment.ComId);
                command.Parameters.AddWithValue("createdtime", comment.CreatedTime);
                command.Parameters.AddWithValue("accountid", comment.AccountId);
                command.Parameters.AddWithValue("postid", comment.PostId);
                command.Parameters.AddWithValue("name", comment.AuthorName);
                command.Parameters.AddWithValue("text", comment.Text);

                try
                {
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                catch (Exception e)
                {
                    var stack = e.StackTrace;
                    throw new Exception();
                }

                return true;
            }
        }