Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6537249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:35:40+00:00 2026-05-25T10:35:40+00:00

im trying to add a new user to my database via a form i

  • 0

im trying to add a new user to my database via a form
i prepared the form but my problem is how to save the data from this form to my database ?
im using c# and extjs4.0.1

i know i need to use submit on a button and give it an url
i did that but when i click on it nothing happens! no errors! i get the success info box! but when i check the database, there is nothing inserted!like my updateuser function have never been called?!!

here is my form script:

buttons: [{
                     text: 'Save user',
                     handler: function () {
                             if (this.up('form').getForm().isValid())
                                 this.up('form').getForm().submit
                                 ({// this would submit the form to the configured url
                                     url: 'update.ashx',
                                     success: function (form, action) {
                                         Ext.MessageBox.show({
                                             title: 'Success !',
                                             msg: 'Changes saved successfully<br />',
                                             icon: Ext.MessageBox.INFO
                                         })
                                     },                                        
                                 });
                                 this.up('form').getForm().reset();

                     }

and here is my update.ashx script:

public class update : IHttpHandler
{
    SqlConnection dbConn = new SqlConnection("....");

    public void ProcessRequest(HttpContext context)
    {        }

    public bool IsReusable
    {
        get           {          return false;            }
    }

    public void updateUser(string firstname, string lastname, string email)
    {


        string str = "insert into User  (Name , FName , Email ) values ( '" + firstname + "' , '" + lastname + "' , '" + email + "' )";

        SqlCommand sqlCommand = new SqlCommand(str);
        sqlCommand.Connection = dbConn;
        sqlCommand.CommandType = CommandType.Text;
        SqlDataAdapter sda = new SqlDataAdapter(sqlCommand);
        dbConn.Open();

        if (sqlCommand.Connection.State == ConnectionState.Open)
        {
            sqlCommand.ExecuteNonQuery();
            dbConn.Close();
        }
    }

}

do you have any idea please?
at least let me know if im on the right way or not…
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:35:40+00:00Added an answer on May 25, 2026 at 10:35 am

    first of all “success: function (form, action)” this function call doesn’t mean that the update user was a succes , just that the submit was successful .. for success you need to encode a json with success true, and then action.result.success will determine if success was true… check the api …..

    Second, i’m not much of a c# guy … but it seems you don’t even process the request

    Edit:

    To avoid your duplicate problem send an extra param to the handler … and execute the update method only when receiving the update action in the request

    url: 'update.ashx',
    params: {action: 'update'},
    success: function (form, action) {
    

    the form submit sends the form values to the handler inside the HttpRequest object contained by the context object.. for retriving the form values you can check http://msdn.microsoft.com/en-us/library/system.web.ihttphandler.processrequest.aspx example

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a new user to a mysql database. The original state
I was trying to add a User in my database using Java with Spring
Trying to add a new element to the DOM but I get all sorts
I'm trying to add a new node to an jQuery SimpleTree , but all
I'm trying to add a new ADO.Net Entity Data Model to an MVC project
Im trying to add an element to a database and then return a new
I'm fairly new to JQuery and I'm trying to add multiple form fields for
I'm trying to create a new contact and add it to the AddressBook but
I am using MySQL 5.1. When i am trying to add new column, it
I'm new to databases and am trying to add a new record using SQL.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.