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

The Archive Base Latest Questions

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

I am using ASP.NET 4.0 and SQL Server 2008 R2.I am want to Insert

  • 0

I am using ASP.NET 4.0 and SQL Server 2008 R2.I am want to Insert the datas using Stored procedure for the “User register” webpage. Whenever i insert the data, the error display as “Procedure or function ‘usp_User_Info2’ expects parameter ‘@UserName’, which was not supplied”.But I entered all required fields except SNo (Identity column) and Vendor_ID (Computed column).What the solution for this ? And also I want “Vendor_ID” display in the message box after insert.

    CREATE TABLE User_Info2
    (
     SNo int Identity (2000,1) , 
     Vendor_ID AS 'VEN' + CAST(SNo as varchar(16)) PERSISTED PRIMARY KEY,
     UserName VARCHAR(16) NOT NULL,
     User_Password VARCHAR(12) NOT NULL,
     User_ConPassword VARCHAR(12) NOT NULL,
     User_FirstName VARCHAR(25) NOT NULL,
     User_LastName VARCHAR(25) SPARSE NULL,
     User_Title VARCHAR(35) NOT NULL,
     User_EMail VARCHAR(35) NOT NULL,
     User_PhoneNo VARCHAR(14) NOT NULL,
     User_MobileNo VARCHAR(14)NOT NULL,
     User_FaxNo VARCHAR(14)NOT NULL,
     UserReg_Date DATE DEFAULT GETDATE()
    )

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[usp_User_Info2]
    @UserName VARCHAR(30),
    @User_Password VARCHAR(12),
    @User_ConPassword VARCHAR(12),
    @User_FirstName VARCHAR(25),
    @User_LastName VARCHAR(25),
    @User_Title VARCHAR(35),
    @User_OtherEMail VARCHAR(30),
    @User_PhoneNo VARCHAR(14),
    @User_MobileNo VARCHAR(14),
    @User_FaxNo VARCHAR(14)
    AS
    BEGIN
SET NOCOUNT ON;
    INSERT INTO User_Info2 (UserName,User_Password,User_ConPassword,User_FirstName,User_LastName,
     User_Title,User_OtherEmail,User_PhoneNo,User_MobileNo,User_FaxNo)
           VALUES     (@UserName,@User_Password,@User_ConPassword,@User_FirstName,@User_LastName,
    @User_Title,@User_OtherEMail,@User_PhoneNo,@User_MobileNo,@User_FaxNo)
    END

    protected void BtnUserNext_Click(object sender, EventArgs e)
    {
        SqlConnection SqlCon = new SqlConnection(GetConnectionString());
        SqlCommand cmd = new SqlCommand();
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "usp_User_Info2";
        cmd.Parameters.Add("@User_Email", SqlDbType.VarChar).Value = txtUserName.Text.Trim();
        cmd.Parameters.Add("@User_Password",SqlDbType.VarChar).Value = txtRegPassword.Text;
        cmd.Parameters.Add("@User_ConPassword",SqlDbType.VarChar).Value = txtRegConPassword.Text;
        cmd.Parameters.Add("@User_FirstName",SqlDbType.VarChar).Value = txtRegFName.Text.Trim();
        cmd.Parameters.Add("@User_LastName",SqlDbType.VarChar).Value = txtRegLName.Text.Trim();
        cmd.Parameters.Add("@User_Title",SqlDbType.VarChar).Value = txtRegTitle.Text.Trim();
        cmd.Parameters.Add("@User_OtherEmail", SqlDbType.VarChar).Value = txtOtherEmail.Text;
        cmd.Parameters.Add("@User_PhoneNo",SqlDbType.VarChar).Value = txtRegTelephone.Text;
        cmd.Parameters.Add("@User_MobileNo", SqlDbType.VarChar).Value = txtRegMobile.Text.Trim();
        cmd.Parameters.Add("@User_FaxNo", SqlDbType.VarChar).Value = txtRegFax.Text.Trim();
        cmd.Connection = SqlCon;
        try
        {
            SqlCon.Open();
            cmd.ExecuteScalar();
        }
        finally
        { string url = "../CompanyBasicInfo.aspx?Parameter=" + Server.UrlEncode
          ("+ Vendor_ID  +"); 
              ClientScript.RegisterStartupScript(this.GetType(), "callfunction",
              "alert('Login created successfully for "+ Vendor_ID +"');
              window.location.href = '"  + url + "';", true); 
              SqlCon.Close();
        }        
       }
  • 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-09T16:48:29+00:00Added an answer on June 9, 2026 at 4:48 pm
       cmd.Parameters.Add("@User_Email", SqlDbType.VarChar).Value = txtUserName.Text.Trim();
    

    should be:

       cmd.Parameters.Add("@UserName", SqlDbType.VarChar).Value = txtUserName.Text.Trim();
    

    To get the identity column add this at the bottom of your stored procedure:

    SELECT SCOPE_IDENTITY() 'Id'
    

    And get the value from ExecuteScalar:

    Vendor_ID = "VEN" + ((int)cmd.ExecuteScalar()).ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using C# ASP.NET 4 and SQL Server 2008 R2 I'm getting an object
I'm using SQL Server 2008 as my database engine in a VS2010, C# ASP.NET
I have an asp.net web application written in C# using a SQL Server 2008
I'm developing an ASP.NET app (C#) that connect to SQL Server 2008 using ADO.NET
I'm using Visual Studio 2008 (Asp.net (c#)) and SQl Server 2005 I have a
I am using ASP.NET MVC2 in Visual Studio 2008. I believe the SQL Server
I am developing a asp.net application and i am using SQL Server 2008. I
Working on VS 2010 C# ASP.NET and SQL Server 2008 R2 I'm using a
I am using VS 2008 (asp.net with c#) and SQL Server 2005 .... Subject
I'm using Asp.Net 4 and SQL Server 2008 R2. I would like to know

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.