你需要将DataContext.Log属性设置为一个writer,你可以将一个writer包装在一个stringbuilder然后插入response.write你的stringbuilder.tostring ...
StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); Context.Log = writer; ... DOINSERT & SUBMITCHANGES ... Response.Write(sb.ToString());