0

the SqlParameter I believe is my issue and I'm not sure a way around it. I have a check box list to store multiple values, such as "[ID],[City],[Amount]" and when add them into my listcheckbox string, I can see it's there but when I pass it into a SqlParameter, it's only grabbing "[ID]" one name from the list and not the rest.

SqlParameter TableList = new SqlParameter("@TableList", listCheckBox);

Anyone had this problem before?

smolchanovsky
  • 1,775
  • 2
  • 15
  • 29
  • See the duplicate for how to work with parameters. A parameters can hold **1** value, no more. – Igor Oct 10 '18 at 17:45
  • From the code shown I can only guess that you are trying to pass the whole ListCheckbox control as the parameter value - this will never work because an SqlParameter can only handle primitve types like strings or numbers. – Filburt Oct 10 '18 at 17:46
  • @Filburt that is not accurate. An SQLParameter can also hold a data table, corresponding to a user defined table type in the database. – Zohar Peled Oct 11 '18 at 08:48
  • @ZoharPeled Admittedly I over-simplyfied here but since the OP is clearly a beginner I thought it best to leave the complex types unmentioned. – Filburt Oct 11 '18 at 09:04

0 Answers0