////// 从URL获取值(字符串) /// public static string GetValueFromUrl(string key) { string keyvalue = HttpContext.Current.Request.QueryString[key]; if (keyvalue != null) { keyvalue = KillBadString(keyvalue); return keyvalue; } return ""; } ////// 从URL获取值(整型) /// /// ///public static int GetIntValueFromUrl(string key) { string keyvalue = HttpContext.Current.Request.QueryString[key]; int result = 0; if (int.TryParse(keyvalue, out result)) { return result; } return result; } /// /// 过滤SQL敏感字符 /// /// ///public static string KillBadString(string str) { if (str == null || str.Length == 0) { return ""; } str = System.Text.RegularExpressions.Regex.Replace(str, "'", "''"); return str; }
本文介绍了Python操作MYSQL、执行SQL语句、获取结果集、遍历结果集、取得某个字段、获取表字段名、将图片插入数据库、执行事务等各种代码实例和详细介绍,代码居多,是一桌丰盛唯美的代码大餐。如果想查看在线版请访问:https://www.jb51.net/article/34102.htm









