程序中直接进行SQL语句拼接。可能有些读者不太明白。下面通过一个登录时对用户验证来说明:
验证时的sql语句: select * from where user='"+txtUsername.Text+"' and pwd='"+txtPwd.Text+"'
如果用户名:admin 密码: admin, 则SQL语句为:select * from where user='admin' and pwd='admin'
如果用户名和密码都是用‘ or '1'='1 则可以登陆。
本文转自 陈敬(Cathy) 博客园博客,原文链接:http://www.cnblogs.com/janes/archive/2009/03/19/1416939.html,如需转载请自行联系原作者