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 8350143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:13:27+00:00 2026-06-09T08:13:27+00:00

I have registration form and i am inserting mandatory fields at first page after

  • 0

I have registration form and i am inserting mandatory fields at first page after that based on userid i am updating some details in the second page below is my code

ALTER procedure [dbo].[Insertreg]

( @id int output,@FirstName varchar (50),@LastName varchar(50) ,@Dob datetime,
        @Gender varchar(20) ,@MobileNo nchar(10) ,@Country varchar(50) ,
    @State varchar (50),@EmailId varchar (50),@Password nchar (15)

)
as
begin
insert into Profile_Master(FirstName,LastName,Dob,Gender,MobileNo,Country,State,EmailId,Password)
 values
(@FirstName,@LastName,@Dob,@Gender,@MobileNo,@Country,@State,@EmailId,@Password)
set @id=SCOPE_IDENTITY()
end


    ALTER procedure [dbo].[sp_update]

(@id int output,@FormFiledBy varchar (50),@MaritalStatus varchar (50),@Height varchar (50),
@Religion varchar (50),@Caste varchar (100),
 @MotherTongue varchar(50),@Education varchar (100),@Occupation varchar(50),
 @CountryofResidence varchar (50),@EducationDetails varchar (100),@AnnualIncome varchar(50),
@CountryOfBirth varchar(50),@BirthPlace varchar(50),@TimeOfBirth nchar(10),@StarSign varchar (100),
@Gothram varchar (50),@Rassi varchar(50),@HavinChildren varchar(10),@PhysicalStatus varchar (100))

as
begin

update Profile_Master
 set FormFiledBy=@FormFiledBy,MaritalStatus=@MaritalStatus,Height=@Height,
Religion=@Religion,Caste=@Caste,MotherTongue=@MotherTongue,
Education=@Education,Occupation=@Occupation,CountryofResidence=@CountryofResidence,EducationDetails=@EducationDetails,
AnnualIncome=@AnnualIncome,CountryOfBirth=@CountryOfBirth,BirthPlace=@BirthPlace,TimeOfBirth=@TimeOfBirth,
StarSign=@StarSign,Gothram=@Gothram,Rassi=@Rassi,HavinChildren=@HavinChildren,PhysicalStatus=@PhysicalStatus

where UserId=@id
end

protected void Button1_Click(object sender, EventArgs e)
    {
        // Get User ID from DAL
        int chk = 0;
        if (Session["EmailID"] != null)
        {
            emailID = Session["EmailID"].ToString();
        }
        ProfileMasterBLL prfbll =new ProfileMasterBLL();
        prfbll.EmailID = emailID;
        string userid = ProfileMasterDAL.GetUserIdByEmailID(emailID);

        // Capture remaining parameters
        if (userid != null)
        {

            prfbll.FormFiledBy = RadioButtonList1.SelectedItem.Text;
            prfbll.MaritalStatus = RadioButtonList2.SelectedItem.Text;
            prfbll.Height = DropDownList1.SelectedItem.Text;
            prfbll.PhysicalStatus = RadioButtonList4.SelectedItem.Text;
            prfbll.Religion = DropDownList2.SelectedItem.Text;
            prfbll.Caste = DropDownList3.SelectedItem.Text;
            prfbll.MotherTongue = DropDownList4.SelectedItem.Text;
            prfbll.Education = DropDownList5.SelectedItem.Text;
            prfbll.Occupation = DropDownList6.SelectedItem.Text;
            prfbll.CountryofResidence = DropDownList8.SelectedItem.Text;
            prfbll.EducationDetails = TextBox3.Text;
            prfbll.AnnualIncome = DropDownList7.SelectedItem.Text;
            prfbll.CountryOfBirth = DropDownList9.SelectedItem.Text;
            prfbll.BirthPlace = TextBox6.Text;
            prfbll.TimeOfBirth = TextBox7.Text;
            prfbll.StarSign = DropDownList10.SelectedItem.Text;
            prfbll.Gothram = TextBox8.Text;
            prfbll.Rassi = DropDownList12.Text;

            if (RadioButtonList2.SelectedItem.Text != "Single")
            {
                prfbll.HavinChildren = RadioButtonList7.SelectedItem.Text;
            }
            else
                {
                    RadioButtonList7.SelectedItem.Text = null;
                }
            }


            try
            {
                chk = ProfileMasterDAL.update(prfbll);
                if (chk >= 0)
                {
                    Response.Write("<script language='javascript'>alert('details updated');</script>");
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
    }


public static int update(ProfileMasterBLL profileMasterBLL)
    {
        SqlParameter uid;
        SqlConnection conn = Generic.DBConnection.OpenConnection();
        try
        {
            SqlCommand cmdd = new SqlCommand("sp_update", conn);
            cmdd.CommandType = CommandType.StoredProcedure;
            cmdd.Parameters.AddWithValue("@FormFiledBy", profileMasterBLL.FormFiledBy);
            cmdd.Parameters.AddWithValue("@MaritalStatus", profileMasterBLL.MaritalStatus);
            cmdd.Parameters.AddWithValue("@Height", profileMasterBLL.Height);
            cmdd.Parameters.AddWithValue("@Religion", profileMasterBLL.Religion);
            cmdd.Parameters.AddWithValue("@Caste", profileMasterBLL.Caste);
            cmdd.Parameters.AddWithValue("@Education", profileMasterBLL.Education);
            cmdd.Parameters.AddWithValue("@Occupation", profileMasterBLL.Occupation);
            cmdd.Parameters.AddWithValue("@CountryofResidence", profileMasterBLL.CountryofResidence);
            cmdd.Parameters.AddWithValue("@EducationDetails", profileMasterBLL.EducationDetails);
            cmdd.Parameters.AddWithValue("@CountryOfBirth", profileMasterBLL.CountryOfBirth);
            cmdd.Parameters.AddWithValue("@BirthPlace", profileMasterBLL.BirthPlace);
            cmdd.Parameters.AddWithValue("@TimeOfBirth", profileMasterBLL.TimeOfBirth);
            cmdd.Parameters.AddWithValue("@StarSign", profileMasterBLL.StarSign);
            cmdd.Parameters.AddWithValue("@Gothram", profileMasterBLL.Gothram);
            cmdd.Parameters.AddWithValue("@Rassi", profileMasterBLL.Rassi);
            cmdd.Parameters.AddWithValue("@HavinChildren", profileMasterBLL.HavinChildren);
            cmdd.Parameters.AddWithValue("@PhysicalStatus", profileMasterBLL.PhysicalStatus);
            cmdd.Parameters.AddWithValue("@MotherTongue", profileMasterBLL.MotherTongue);
            cmdd.Parameters.AddWithValue("@AnnualIncome", profileMasterBLL.AnnualIncome);
            uid = cmdd.Parameters.Add("@id", System.Data.SqlDbType.Int);
            uid.Direction = System.Data.ParameterDirection.Output;
            return cmdd.ExecuteNonQuery();


        }
        catch (Exception ex)
        {

            throw ex;
        }

    }

but the problem is values are not getting updated in the DB can anyone tell me what is wrong?

public static int Insert(ProfileMasterBLL profileMasterBLL)
    {
        // bool flag = false;
        SqlParameter pid;
        SqlConnection con = Generic.DBConnection.OpenConnection();

        try
        {

            SqlCommand cmd1 = new SqlCommand("Insertreg", con);
            cmd1.CommandType = CommandType.StoredProcedure;
            cmd1.Parameters.AddWithValue("@FirstName", profileMasterBLL.FirstName);
            cmd1.Parameters.AddWithValue("@LastName", profileMasterBLL.LastName);
            cmd1.Parameters.AddWithValue("@Dob", profileMasterBLL.Dob);
            cmd1.Parameters.AddWithValue("@Gender", profileMasterBLL.Gender);
            cmd1.Parameters.AddWithValue("@MobileNo", profileMasterBLL.MobileNo);
            cmd1.Parameters.AddWithValue("@Country", profileMasterBLL.Country);
            cmd1.Parameters.AddWithValue("@State", profileMasterBLL.State);
            cmd1.Parameters.AddWithValue("@EmailId", profileMasterBLL.EmailID);
            cmd1.Parameters.AddWithValue("@Password", profileMasterBLL.Password);
           pid = cmd1.Parameters.Add("@id", System.Data.SqlDbType.Int);
            pid.Direction = System.Data.ParameterDirection.Output;
            return cmd1.ExecuteNonQuery();
  • 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-06-09T08:13:29+00:00Added an answer on June 9, 2026 at 8:13 am

    Your update procedure is expecting to update

    where UserId=@id
    

    but you are not passing in an id.

    If this class

    ProfileMasterBLL 
    

    has a user id, you could assign it when you update the rest of the fields

      if (userid != null)
            {
                prfbll.UserId = userid; //Or whatever it's called
                prfbll.FormFiledBy = RadioButtonList1.SelectedItem.Text;
    

    if not you need to update the signature

    public static int update(ProfileMasterBLL profileMasterBLL, string userId)
    

    and then pass the user id in also.

    This would require changes to the parameters and to the stored procedure.

    The SP shouldn’t take an OUT param (and thus shouldn’t be passed in that way.

        ALTER procedure [dbo].[sp_update]
    
    (@id int ,@FormFiledBy varchar (50),@MaritalStatus varchar (50),@Height varchar (50),
    @Religion varchar (50),@Caste varchar (100),
     @MotherTongue varchar(50),@Education varchar (100),@Occupation varchar(50),
     @CountryofResidence varchar (50),@EducationDetails varchar (100),@AnnualIncome varchar(50),
    @CountryOfBirth varchar(50),@BirthPlace varchar(50),@TimeOfBirth nchar(10),@StarSign varchar (100),
    @Gothram varchar (50),@Rassi varchar(50),@HavinChildren varchar(10),@PhysicalStatus varchar (100))
    
    as
    begin
    
    update Profile_Master
     set FormFiledBy=@FormFiledBy,MaritalStatus=@MaritalStatus,Height=@Height,
    Religion=@Religion,Caste=@Caste,MotherTongue=@MotherTongue,
    Education=@Education,Occupation=@Occupation,CountryofResidence=@CountryofResidence,EducationDetails=@EducationDetails,
    AnnualIncome=@AnnualIncome,CountryOfBirth=@CountryOfBirth,BirthPlace=@BirthPlace,TimeOfBirth=@TimeOfBirth,
    StarSign=@StarSign,Gothram=@Gothram,Rassi=@Rassi,HavinChildren=@HavinChildren,PhysicalStatus=@PhysicalStatus
    
    where UserId=@id
    end
    

    and the parameter should be added

        SqlParameter uid;
        SqlConnection conn = Generic.DBConnection.OpenConnection();
        try
        {
            SqlCommand cmdd = new SqlCommand("sp_update", conn);
            cmdd.CommandType = CommandType.StoredProcedure;
            cmdd.Parameters.AddWithValue("@Id", userId ); //Or profileMasterBLL.UserId or whatever
            cmdd.Parameters.AddWithValue("@FormFiledBy", profileMasterBLL.FormFiledBy);
            cmdd.Parameters.AddWithValue("@MaritalStatus", profileMasterBLL.MaritalStatus);
            cmdd.Parameters.AddWithValue("@Height", profileMasterBLL.Height);
            cmdd.Parameters.AddWithValue("@Religion", profileMasterBLL.Religion);
            cmdd.Parameters.AddWithValue("@Caste", profileMasterBLL.Caste);
            cmdd.Parameters.AddWithValue("@Education", profileMasterBLL.Education);
            cmdd.Parameters.AddWithValue("@Occupation", profileMasterBLL.Occupation);
            cmdd.Parameters.AddWithValue("@CountryofResidence", profileMasterBLL.CountryofResidence);
            cmdd.Parameters.AddWithValue("@EducationDetails", profileMasterBLL.EducationDetails);
            cmdd.Parameters.AddWithValue("@CountryOfBirth", profileMasterBLL.CountryOfBirth);
            cmdd.Parameters.AddWithValue("@BirthPlace", profileMasterBLL.BirthPlace);
            cmdd.Parameters.AddWithValue("@TimeOfBirth", profileMasterBLL.TimeOfBirth);
            cmdd.Parameters.AddWithValue("@StarSign", profileMasterBLL.StarSign);
            cmdd.Parameters.AddWithValue("@Gothram", profileMasterBLL.Gothram);
            cmdd.Parameters.AddWithValue("@Rassi", profileMasterBLL.Rassi);
            cmdd.Parameters.AddWithValue("@HavinChildren", profileMasterBLL.HavinChildren);
            cmdd.Parameters.AddWithValue("@PhysicalStatus", profileMasterBLL.PhysicalStatus);
            cmdd.Parameters.AddWithValue("@MotherTongue", profileMasterBLL.MotherTongue);
            cmdd.Parameters.AddWithValue("@AnnualIncome", profileMasterBLL.AnnualIncome);
    

    Also remove these
    uid = cmdd.Parameters.Add(“@id”, System.Data.SqlDbType.Int);
    uid.Direction = System.Data.ParameterDirection.Output;
    return cmdd.ExecuteNonQuery();

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

Sidebar

Related Questions

I have a registration form that includes sfRegistration and sfProfile, which after completion, get's
Scenario: - We have registration form that checks for errors via AJAX - Fields
I have a registration form and used fieldset to order the input fields in
I have a registration form with common registration fields and two multiple selection Lists
I have a registration form that when the user enters in valid registration data
I'm building my first CodeIgniter app - and have a registration form. I'm using
I'm working on a simple mobile site that have a registration form for Interest,
I have a registration form for a website that needs to check if an
I have a registration form that is rendered by the following urlconf -- url(r'^$',
I have a registration form with password and confirm password input fields. I want

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.