编程浪子的博客

碌碌无为终为过

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2010年2月1日

摘要: 在代码中使用了大量像这样的Sql 语句:InitializeComponent();string s = "select * from tableName where id = ‘"+this.textBox1.Text.Trim()+"'"; 今天看书发现这样写很危险!恶意用户可以凭借这段代码干掉我的数据库!比如在textbox1里边输入下边的东西:123';drop table Table1--之后,Sql语句成了这样:select * from tableName where id= '123';drop table Table1—'这在SqlServer是完全可以执行下去的。结果是查 阅读全文
posted @ 2010-02-01 22:57 编程浪子_ 阅读(649) 评论(2) 推荐(0) 编辑