How to use DropDownList.SelectedIndex from datasource?
<p>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.</p>

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

<pre><code>Insert Error:Error converting data type nvarchar to numeric.
</code></pre>

<p>I do not know for which control it is telling it for. </p>

<p>But there is a statement here-</p>

<pre><code>cmd.Parameters.AddWithValue("@EmpType",DropDownList1.SelectedIndex);
cmd.Parameters.AddWithValue("@DeptID", DropDownList3.SelectedIndex);
</code></pre>

<p>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.</p>

<p>What do I do? </p>

<p>This is my bind class.</p>

<pre><code>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();
            }

        }
</code></pre>
