Syntax error converting the nvarchar value to a column of data type int.
Posted
by Phil
on Stack Overflow
See other posts from Stack Overflow
or by Phil
Published on 2010-05-05T07:38:31Z
Indexed on
2010/05/05
7:48 UTC
Read the original article
Hit count: 298
I have 1,2,3,4,5,6,7,8,9 stored as nvarchar inside Level in my db.
I then have a dropdownlist with values 1,2,3,4,5,6,7,8,9. When a user makes a selection (i.e 1) (Level.SelectedValue.ToString). This builds an sql query via a param like this:
"Select things From MBA_EOI Where level = 1"
When I run the select I get the following error:
Syntax error converting the nvarchar value '1,2,3,4,5,6,7,8,9' to a column of data type int.
I was under the impression that I was dealing with an Nvarchar field and the selected value as string, where does the int conversion come in?
p.s I have also tried Level.SelectedItem.ToString
© Stack Overflow or respective owner