passing small int data from SQL to textbox

Viewed 41

I am not sure how to approach this. Currently I am getting a column from my database that is entitled "ITEMNMBR" which is of type "char" and then pass it to a textBox. That part of my code works fine but what I want to do now is to get another column and pass it to another comboBox. The column which is named "ITEMTYPE" is of smallint. What am I doing wrong?

while (dr.Read())
            {
                string cari_code = dr.GetString(dr.GetOrdinal("ITEMNMBR"));
                textBox2.Text = cari_code;
                string intFromSmallInt = dr.GetInt16(dr.GetOrdinal("ITEMTYPE"));
                textBox12.Text = intFromSmallInt; 

                //con.Close();

            }
        }
0 Answers
Related