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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:10:47+00:00 2026-06-08T16:10:47+00:00

I have an ASP.NET Wizard for registration. In step 1, I have few controls

  • 0

I have an ASP.NET Wizard for registration.
In step 1, I have few controls that goes into table dbo.Emp. In this step1, I have couple of DropDownList that is binded from code-behind from different table called dbo.Emptype.

However, while inserting the form to table dbo.Emp, I am getting following error-

Insert Error:Error converting data type nvarchar to numeric.

I do not know for which control it is telling it for.

But there is a statement here-

cmd.Parameters.AddWithValue("@EmpType",DropDownList1.SelectedIndex);
cmd.Parameters.AddWithValue("@DeptID", DropDownList3.SelectedIndex);

I want the INT values that is associated with items in EmpType to be inserted into the table.
DropDownList1 is binded to the table called Dbo.EmpType (TypeID (PK- AutoIncrement)| Type)
So, when a user drops down that control and select value, I need DataValueField (i.e TypeID) to get inserted into the table.

What do I do?

This is my bind class.

public void dropdowntype()
        {
            SqlConnection myConn = new SqlConnection(@"Data Source=USER-PC\SQLEXPRESS;Initial Catalog=KKSTech;Integrated Security=True");
            SqlCommand myCmd = new SqlCommand(
                "SELECT Type, TypeID FROM EmpType", myConn);
            myConn.Open();
            SqlDataReader myReader3 = myCmd.ExecuteReader();

            //Set up the data binding.
            Emp_type.DataSource = myReader3;
            Emp_type.DataTextField = "Type";
            Emp_type.DataValueField = "TypeID";
            Emp_type.DataBind();



 //Close the connection.
            myConn.Close();
            myReader3.Close();

        }
protected void Page_Load(object sender, EventArgs e)
        {
            if (!(Page.IsPostBack))
            {
                dropdownDept();
                dropdowntype();
                dropdownskills();
            }

        }
  • 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-08T16:10:48+00:00Added an answer on June 8, 2026 at 4:10 pm

    If you need the data value feild from your dropdown then use this statement

    cmd.Parameters.AddWithValue("@EmpType",DropDownList1.SelectedValue);
    cmd.Parameters.AddWithValue("@DeptID",DropDownList3.SelectedValue);
    

    You are currently selecting the index of the dropdown.

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

Sidebar

Related Questions

I have this ASP.net MVC project that requires a wizard like interface... So I
I have an ASP.NET 3.5 webforms project written in VB that involves a multi-table
I have an ASP.NET site that uses a standard, wizard created login control. I
Using Asp.Net MVC3, I have many steps in a wizard where after every step
Coding Platform: ASP.NET C# Controls Used: asp:Wizard and asp:Button I have a asp:Wizard and
I have a wizard in my asp.net MVC application which is built upon this
I have used Visual Studio 2008 ASP.NET AccessDataSource Wizard to generate the update command.
I have asp.net TextBox with ontextchanged event this is search text box in my
I have asp.net Menu Item <asp:MenuItem NavigateUrl= Text=Download Value=Download/> . When this item gets
i have read somewhere about using layout template in asp.net wizard control but when

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.