【发布时间】:2011-11-03 14:53:20
【问题描述】:
我已经写了这个插入查询:
INSERT INTO tblUsers(FirstName, LastName, UserName, Password
, EmailId, Created_Date, typeid)
VALUES ('" + ObjUserProp.FirstName + "','" + ObjUserProp.LastName + "'
,'" + ObjUserProp.UserName + "','" + ObjUserProp.Password + "'
,'" + ObjUserProp.EmailId + "','" + ObjUserProp.Created_Date + "'
," + ObjUserProp.TypeId + ")
我需要检查用户名和电子邮件是否存在。如果不存在则仅插入记录,否则返回 false
【问题讨论】:
-
亲爱的投票者,如果您必须投票,请至少说明原因。问题很清楚,数据库设计是可疑的(存储未加密的密码,不加盐)。之前已经问过几次(很可能),但在那种情况下,用 dup 链接投了一个密切的投票。