So, from the line where exception is occurring, it is clear that
DCCODE
is an
Integer
field in
Table
, whereas you are sending a string value
ddldept.SelectedValue
.
You need to convert that to INT. So you can do like below...
int selectedValue;
Int32.TryParse(ddldept.SelectedValue, out selectedValue);
Now use this
selectedValue
in the query.
NOTE
I just tried to fix the exception you are getting now. But you should implement the solutions advised by
OriginalGriff and
_Amy.