宿主语言(VB,C#)嵌入SQL语句时,单引号处理方法:
方法一:采用参数传递法(@param).
方法二:采用补引号函数:
//传递要处理的字串
public static string CheckStr(string str_check)
{
string str=str_check;
int pos=str.IndexOf("'");
while(pos>=0)
{
str=str.Insert(pos,"'");
pos=str.IndexOf("'",pos+2);
}
return str;
}
浙公网安备 33010602011771号