var strsql = "insert into Staff_Answer (ExamTitleID,QuestionsID,MultipleChoice,RightOption,AnswerOption,IsRight,Score,StaffScore,Remark,State,Creator,CreatOrg,CreateTime) values";
strsql += "(@ExamTitleID,@QuestionsID,@MultipleChoice,@RightOption,@AnswerOption,@IsRight,@Score,@StaffScore,@Remark,@State,@Creator,@CreatOrg,@CreateTime)";
var cmd = new SqlCommand(strsql);
var param = new SqlParameter[] {
new SqlParameter("@ExamTitleID",SqlDbType.UniqueIdentifier),
new SqlParameter("@QuestionsID",SqlDbType.UniqueIdentifier),
new SqlParameter("@MultipleChoice",SqlDbType.NVarChar,),
new SqlParameter("@RightOption",SqlDbType.NVarChar,),
new SqlParameter("@AnswerOption",SqlDbType.NVarChar,),
new SqlParameter("@IsRight",SqlDbType.NVarChar,),
new SqlParameter("@Score",SqlDbType.Decimal,),
new SqlParameter("@StaffScore",SqlDbType.Decimal,),
new SqlParameter("@Remark",SqlDbType.Text),
new SqlParameter("@State",SqlDbType.NVarChar,),
new SqlParameter("@Creator",SqlDbType.NVarChar,),
new SqlParameter("@CreatOrg",SqlDbType.NVarChar,),
new SqlParameter("@CreateTime",SqlDbType.NVarChar,)
}; param[].Value = new Guid(this.ExamTitleCode.Value);
param[].Value = new Guid(QuestionsID);
param[].Value = Anserdt.Rows[]["MultipleChoice"].ToString();
param[].Value = RightOption;
param[].Value = AnswerOption;
param[].Value = ISRight ? "" : "";
param[].Value = Convert.ToInt32(Question.Rows[]["Score"]);
param[].Value = ISRight ? Convert.ToInt32(Question.Rows[]["Score"]) : ;
param[].Value = this.Remark.InnerText;
param[].Value = "";
param[].Value = userid;
param[].Value = Orgname1;
param[].Value = DateTime.Now; foreach (SqlParameter para in param)
{
cmd.Parameters.Add(para);
}
helps.GetExecuteNonQueryBySqlPa(cmd);
}

感谢同事给我提供的内容

sql 防注入插入的更多相关文章

  1. sql 防注入 维基百科

    http://zh.wikipedia.org/wiki/SQL%E8%B3%87%E6%96%99%E9%9A%B1%E7%A2%BC%E6%94%BB%E6%93%8A SQL攻击(SQL inj ...

  2. SQL防注入程序 v1.0

    /// ***************C#版SQL防注入程序 v1.0************ /// *使用方法: /// 一.整站防注入(推荐) /// 在Global.asax.cs中查找App ...

  3. PHP之SQL防注入代码集合(建站常用)

    SQL防注入代码一 <?php if (!function_exists (quote)) { function quote($var) { if (strlen($var)) { $var=! ...

  4. 特殊字符的过滤方法,防sql防注入代码的过滤方法

    特殊字符的过滤方法 function strFilter($str){ //特殊字符的过滤方法 $str = str_replace('`', '', $str); $str = str_replac ...

  5. SQL防注入程序

    1.在Global.asax.cs中写入: protected void Application_BeginRequest(Object sender,EventArgs e){      SqlIn ...

  6. PHP SQL防注入

    过年前后在做一个抽奖的东西,需要用户填写中奖信息,为了防止非法用户对数据库进行入侵神马的,于是写下基本的防注入语句,需要用的可以自己封装成一个function. $str = str_replace( ...

  7. 360提供的SQL防注入

    <?php class sqlsafe { private $getfilter = "'|(and|or)\\b.+?(>|<|=|in|like)|\\/\\*.+?\ ...

  8. .net sql 防注入 httpmodule

    1 新建一个类,实现IHttpModule接口 using System; using System.Collections.Generic; using System.Linq; using Sys ...

  9. PHP之SQL防注入代码(360提供)

    <?php class sqlsafe { private $getfilter = "'|(and|or)\\b.+?(>|<|=|in|like)|\\/\\*.+?\ ...

随机推荐

  1. python 1: 解决linux系统下python中的matplotlib模块内的pyplot输出图片不能显示中文的问题

    问题: 我在ubuntu14.04下用python中的matplotlib模块内的pyplot输出图片不能显示中文,怎么解决呢? 解决: 1.指定默认编码为UTF-8: 在python代码开头加入如下 ...

  2. jquery和CSS3带倒影的3D万花筒旋转动画特效效果演示

    <!DOCTYPE html> <html> <head> <title></title> <meta charset='utf-8' ...

  3. redis04-----Hash 哈希数据类型相关命令

    Hash 哈希数据类型相关命令 hset key field value 这里的域就是键值对的键. 作用: 把key中 filed域的值设为value 注:如果没有field域,直接添加,如果有,则覆 ...

  4. ReactNative Android 研究

    先从ReactRootView入手吧,它是一个FrameLayout mReactRootView.startReactApplication 这的start其实是会等到inital onMeasur ...

  5. 做了一道跑大数据的最短路挂了,基于vector的二维模拟邻接表实现Dijkstra算法(*【模板】)

    代码: #include <stdio.h> #include <string.h> #include <string> #include <vector&g ...

  6. js实现网页多少秒后自动跳转到指定网址

    在网上搜了一下,关于这个技术处理有多种方法,我只记下我在视频里学到的三种: 1.用一个response.sendRedirect("目标页面.jsp\.htm");实现直接跳转: ...

  7. java多线程实现简单队列

    1.创建Queue.java public class Queue { private LinkedList<Object> list = new LinkedList<Object ...

  8. Oracle:通过pl/sql developer工具导入excel数据

    1.在pl/sql developer中选择工具-->ODBC导入器 2.选择需要导入的EXCEL文件(CVS也可以):用户名.口令不用管,直接点“连接”,找到要导入的xls文件 3. 选择“导 ...

  9. fuse的mount机制 2 -系统调用mount

    经过上一篇的分析,目前已经知道mount函数最终进入到mount.c 中的 int fuse_kern_mount(const char *mountpoint, struct fuse_args * ...

  10. IDEA下搭建简单的SpringBoot工程应用

    (1)File->new,选择maven,创建一个空项目,直接next. (2)填写工程名,next. (3)填写项目名,next,创建一个基于maven的空Java项目. (4)在pom文件中 ...