---
title: "ajax editor in ASP.NET"  
description: "ajax editor in ASP.NET"  
author: "Anonymous User"  
published: 2014-08-22  
updated: 2014-08-22  
canonical: https://www.mindstick.com/forum/2083/ajax-editor-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# ajax editor in ASP.NET

I have an Ajax [Editor](https://www.mindstick.com/forum/78/how-avoid-the-html-tag-and-remove-the-formating-of-copy-in-ajax-editor) in my [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page):

<cc1:Editor ID="Editor1" runat="[server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)" width="600px"/>

What I want is to save the [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) from the Editor to my database.I tried this but it won't work:

[SqlCommand](https://www.mindstick.com/forum/91/difference-between-sqlcommand-and-sqlcommandbuilder) cmd = new SqlCommand(

"[INSERT](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) INTO titlu (descriere) [Values](https://www.mindstick.com/forum/327/sum-textbox-values)(@descriere)",con);

cmd.Parameters.AddWithValue("@descriere", Editor1.Content);

I am using C# and it's a [ASP.Net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) [web application](https://www.mindstick.com/articles/13069/progressive-web-application-pwas-all-you-need-to-know-about).. Why can't I save my [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science)?

## Replies

### Reply by Sumit Kesarwani

Hi Ankita, try this:

```
  using (SqlConnection connection =  new SqlConnection(connectionString))    {        try        {            int count = 0;            SqlCommand command = new SqlCommand(commandText, connection);           
connection.Open();           
IAsyncResult result = command.BeginExecuteNonQuery();            while (!result.IsCompleted)            {               
Console.WriteLine("Waiting ({0})", count++);                // Wait for 1/10 second, so the counter                //does not consume all available resources                 // on the main thread.               
        System.Threading.Thread.Sleep(100);            }           
Console.WriteLine("Command complete. Affected {0} rows.",                
command.EndExecuteNonQuery(result));        }        catch(SqlException ex)        {           
Console.WriteLine("Error ({0}): {1}", ex.Number, ex.Message);        }        catch(InvalidOperationException ex)        {           
Console.WriteLine("Error: {0}", ex.Message);        }        catch(Exception ex)        {            // Youmight want to pass these errors            // backout to the caller.            Console.WriteLine("Error:{0}", ex.Message);        }    }
```


---

Original Source: https://www.mindstick.com/forum/2083/ajax-editor-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
