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. redis06----消息订阅

    使用办法: 订阅端: Subscribe 频道名称 发布端: publish 频道名称 发布内容 r1:>publish news "aaaaaa" "" ...

  2. timestamp 转 date 处理后再转timestamp

    package com.jmu.ccjoin.service.impl; import java.sql.Timestamp;import java.util.Calendar;import java ...

  3. cassandra cpp driver中bind list——用cass_statement_bind_collection函数

    CassError insert_into_collections(CassSession* session, const char* key, const char* items[]) { Cass ...

  4. HDU 1711(KMP)字符串匹配

    链接  HDU 1711 Number Sequence KMP 算法 我以自己理解写的,写的不对,不明白的地方海王子出来,一起共同学习: 字符串匹配 就是KMP,一般思想,用一个for循环找开头   ...

  5. JS复制文本到剪切板

    1.首先引入js文件, <script src="dist/clipboard.min.js"></script> 2.初始化 <script typ ...

  6. 【前端】CentOS 7 系列教程之五: 安装最新版 nginx 并转发 node 服务

    转载请注明出处:http://www.cnblogs.com/shamoyuu/p/linux_5.html 进入/usr/local目录 cd /usr/local 下载最新版的ngxin压缩包 w ...

  7. Android 开发:由模块化到组件化

    在Android SDK一文中,我们谈到模块化和组件化,现在我们来聊聊组件化开发背后的哪些事.最早是在广告SDK中应用组件化,但是同样适用于普通应用开发 以下高能,请做好心理准备,看不懂请发私信来交流 ...

  8. python 查找IP地址归属地

    #!/usr/bin/env python # -*- coding: utf-8 -*- #查找IP地址归属地 #writer by keery_log #Create time:2013-10-3 ...

  9. B. Color the Fence

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  10. C#SuperSocket的搭建--通过配置启动

    之前我们借助一个SuperSocket实现了一个简易版的服务器, 但是不管是Server还是Session都是使用框架的,本篇博客我们要实现自己的Server和Session,来重写框架原生的Serv ...