Posts: 15
Registered: ‎06-11-2020

lineItems load from database C#

I am trying to load info from a database into "lineItems". Like :


                        lineItems[intLoop] = new lineItemType
                            itemId = "1",
                            name =  strItem,
                            quantity = intQty,
                            unitPrice = decPrice

If I set 

strItem="Another test description";


before the lineItems, it WORKS.


Reading a value from the database with spaces in the name,

I put that into a variable string, a few examples


                    strItem = String.Format("\"{0}\"", str5_Item);
var response = controller.GetApiResponse();

I get a 

response is null .


However if I read from database a field with no spaces, it all WORKS.


If the strItem above has spaces in it, I get a response is null.


Suggestions on how to read a column data with SPACES in the field and put that value into 

the "NAME" listed above?