SQL里format使用出现有关问题
SQL里format使用出现问题
TEMP = Format(D_SortYM.Value, "YYYY-MM ")
sqlStr1 = strSQL & "where Format(List.Date, 'YYYY-MM ') = " & TEMP & " order by List.Code "
结果: FORMAT 不是可以识别的函数名
------解决方案--------------------
mssql没有format这个函数,可以改用convert
------解决方案--------------------
cdate(list.date)?
------解决方案--------------------
sqlStr1 = strSQL & "where ' " & Format(List.Date, 'YYYY-MM ') & " '= ' " & TEMP & " ' " & " order by List.Code "
TEMP = Format(D_SortYM.Value, "YYYY-MM ")
sqlStr1 = strSQL & "where Format(List.Date, 'YYYY-MM ') = " & TEMP & " order by List.Code "
结果: FORMAT 不是可以识别的函数名
------解决方案--------------------
mssql没有format这个函数,可以改用convert
------解决方案--------------------
cdate(list.date)?
------解决方案--------------------
sqlStr1 = strSQL & "where ' " & Format(List.Date, 'YYYY-MM ') & " '= ' " & TEMP & " ' " & " order by List.Code "