JavaScript中传递SQL条件中的引号如何处理?
有一个笨问题:就是参数值中的单引号怎么处理?
{window.showModalDialog( 'Search.aspx?QueryMenuCode= '+QueryMenuCode+ '&QueryWhereStr= '+QueryWhereStr,window, 'dialogHeight:400px; dialogWidth:600px; ');}
Asp.net中用如下语句传送参数:
BindSearch( " ", "and qm_code = N '008 ' ")
后面一段是SQL的条件,该怎么写才符合要求,现每次都提示 "缺少) "
------解决方案--------------------escape(sql)
------解决方案--------------------window.showModalDialog( 'Search.aspx?QueryMenuCode= '+QueryMenuCode+ '&QueryWhereStr= '+escape(QueryWhereStr),window, 'dialogHeight:400px; dialogWidth:600px; ');
------解决方案--------------------BindSearch( " ", "and qm_code = N "&chr(asc( '))& "008 "&chr(asc( ')))
------解决方案--------------------{window.showModalDialog( 'Search.aspx?QueryMenuCode= '+QueryMenuCode+ '&QueryWhereStr= '+escape(QueryWhereStr),window, 'dialogHeight:400px; dialogWidth:600px; ');}
在你要传的参数加上escape()