ajax editor in ASP.NET

Total Post:183


 1145  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?

  1. Re: ajax editor in ASP.NET

    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)
                // Youmight want to pass these errors
                // backout to the caller.
                Console.WriteLine("Error:{0}", ex.Message);

      Modified On Apr-04-2018 06:23:23 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.