我有这段代码:
var selectdata = {
"tablename": "dbo.vw_bla",
"where": "ID_Prod like @idprod",
"whereparameters": [{
"name": "idprod",
"value": ' + $(prodvariable) + ',
"type": "varchar"
}],
"orderby": "ID_Prod ASC"
};
prodvariable
是其中a已存储数字的变量。例如6
。这应该作为
6
传递。我尝试了引号,转义,+等的几种组合,但是我找不到正确的方法。
最佳答案
prodvariable
不需要任何引号。直接在值中使用该变量:
var prodvariable = '6';
var selectdata = {"tablename":"dbo.vw_bla",
"where":"ID_Prod like @idprod",
"whereparameters": [
{"name": "idprod",
"value": prodvariable ,
"type":"varchar"}],
"orderby":"ID_Prod ASC"};
console.log(selectdata);
关于javascript - JavaScript对象字符串/引用问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49773347/