宿主语言(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;
  }

posted on 2006-10-21 16:57  mico  阅读(779)  评论(0)    收藏  举报