Not saving the leading zero from one table to another
<p>An error is thrown on a dropdown list that updates a table field. It claims the SelectedValue is invalid because it does not exist in the list of items. If I go into the table and add the zero to the ID the error is no longer thrown.  </p>

<p>The dropdown selects a teacherid which is the primary key from the Teacher table and saves the ID to the Classes table. The classes table saves any IDs that begin with zero without the leading zero.</p>

<p>So if the tid is 0701234 in the Classes table it is saved as 701234 but both tables are nvarchar(255). I might add that the Classes table was using an int datatype for the tid.  so I changed it to avoid this. The error above is still thrown after the change, since you cannot update a record that does not exist. </p>

<p>Here is the control</p>

<pre><code>&lt;asp:DropDownList ID="teacherdd1" runat="server" AutoPostBack="true" 
    DataSourceID="SQLdatasourceTeacherList"
    DataTextField="fullname1" DataValueField="tid" &gt;
&lt;/asp:DropDownList&gt;
</code></pre>

<p>I simply do not know what to do, or why this is happening. </p>

<p>quite simple.  i switched to a textbox to test and forgot to double check this.  my oversight. </p>

<p>thanks</p>

<p>cmdUpdate.Parameters.Add("@TID1", SqlDbType.Int).Value = teacherdd1.SelectedValue.ToString()
   cmdUpdate.Parameters.Add("@TID2", SqlDbType.Int).Value = teacherdd2.SelectedValue.ToString()
   'cmdUpdate.Parameters.Add("@tid1", SqlDbType.NVarChar).Value = txbteacher1.Text.ToString()
   'cmdUpdate.Parameters.Add("@tid2", SqlDbType.NVarChar).Value = txbteacher2.Text.ToString()</p>
