在Typescript中追加字符串

时间:2018-12-01 10:33:11

标签: typescript

我有以下代码

let whereClause =  'CurLocation =' +  GS
                            + ' and Datediff(DD,LastKYCVerified,GetDate()) >= 180 and CreditCard = ' + 'ACTIVE ' +
                            ' and ClientId Not In (Select ClientId from KYCChangeInfo(Nolock))';
在数据库中执行时,

GS应该使用单引号,因为CurLocation是字符串变量。如何将单引号添加到GS和ACTIVE

1 个答案:

答案 0 :(得分:1)

尝试一下:

let whereClause =  'CurLocation =\'' +  GS
                            + '\' and Datediff(DD,LastKYCVerified,GetDate()) >= 180 and CreditCard = \'' + 'ACTIVE ' +
                            '\' and ClientId Not In (Select ClientId from KYCChangeInfo(Nolock))';