private static List<string> ProcessFiles(HttpContext context) { List<string> urls = new List<string>(); var cidsel = new SqlObject(); cidsel.Select("categoryid").From("tCategories").Where("iname", "like", "upload"); string sql = cidsel.ToString(); //var tb = D.DB.GetDataTable(sql); var list = D.DB.ExecuteValue(sql); if (list == null) { throw new CustomException("无法找到文件上传对应的类别。"); } int cid = (int)list; for (int i = 0; i < context.Request.Files.Count; i++) { FileItem file = ProcessSingleFile(context, urls, i); if (file != null) { file.CategoryId = cid; var fins = new SqlObject(); fins.InsertInto(file); sql = fins.ToString(); D.DB.ExecuteNonQuery(sql); } } return urls; }