Home > DeveloperSection > Forums > ajax editor in ASP.NET
Ankita Pandey
Ankita Pandey

Total Post:183

Posted on    August-22-2014 1:32 AM

 ASP.Net ASP.Net 

 1 Reply(s)
 582  View(s)
Rate this:

I have an Ajax Editor in my page:

<cc1:Editor ID="Editor1" runat="server" width="600px"/>

What I want is to save the content from the Editor to my database.I tried this but it won't work:

SqlCommand cmd = new SqlCommand(

    "INSERT INTO titlu (descriere) Values(@descriere)",con);

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

I am using C# and it's a ASP.Net web application.. Why can't I save my data?

Sumit Kesarwani

Total Post:378

Posted on    August-22-2014 2:01 AM

Hi Ankita, 
try this:

  using (SqlConnection connection =

               new SqlConnection(connectionString))




            int count = 0;

            SqlCommand command = new SqlCommand(commandText, connection);


            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.



            Console.WriteLine("Command complete. Affected {0} rows.",



        catch (SqlException ex)


            Console.WriteLine("Error ({0}): {1}", ex.Number, ex.Message);


        catch (InvalidOperationException ex)


            Console.WriteLine("Error: {0}", ex.Message);


        catch (Exception ex)


            // You might want to pass these errors

            // back out to the caller.

            Console.WriteLine("Error: {0}", ex.Message);



Don't want to miss updates? Please click the below button!

Follow MindStick