custom table SQL query value keeps equaling "0"

Jason Herz asked on December 5, 2018 23:16

I have a custom table and I am trying to pull the value "ItemName" into a dropdown selector from the table. But when I change my SQL query to SELECT ItemName, ItemName FROM Custom_Table ORDER BY ItemID I get no value. when I check the output the value is just listed as "0". If I change the select statement to SELECT ItemID, ItemName the values get populated as integers, but I need the values to appear as the ItemName not the ID. Can someone please tell me how I can get the 'ItemName' to populate in the value field?

Correct Answer

Dragoljub Ilic answered on December 6, 2018 17:27

I meant on the dropdown form control. My assumption was that you tried to pull all those data in dropdown on the Kentico form. In that case, datatype of that field (dropdown) in form should be Text.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Dragoljub Ilic answered on December 6, 2018 10:30

Hi Jason,

Check data type field of your dropdown control. If data type of dropdown is integer, then all string values will be added as integer (default 0). You should change it to 'Text' to populate text value into dropdown.

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

Jason Herz answered on December 6, 2018 16:22

Dragoljub, the data type for ItemName has been set to text when it was created, yet the value continues to return only 0s instead of their text names like desired

0 votesVote for this answer Mark as a Correct answer

Jason Herz answered on December 7, 2018 00:48

Dragoljub, thank you very much. Once I changed the data type for the dropdown, the values came over as desired. Thanks again!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.