![](/img/trans.png)
[英]How to disable the Login Button in MS Indentity Login.cshtml page when submitting the user id & password
[英]Login Page, how to check 3 tables for ID & Password
我正在使用visual studio 2010在ASP.net
和C#
为我的Web应用程序创建login
页面。
我的login
页面是空的,只有2个username
和password
text boxes
和一个submit button
,每个控件都有一些必需的字段validations
。
我正在使用SQL Server 2012
,其中有3个表, Student
, Staff
和Admins
,每个表都有两列Username
和password
。
我想要做的是当用户按下submit
按钮时,它会检查学生表中的username
和password
,如果不存在,则检查staff
,然后检查admins
。 如果它不在其中任何一个中,则会error
登录失败的error
。
我在页面上放了一个SQLdatasource
,它从student
表中提取username
和password
,它们等于textboxes
文本。
我是否需要为每个table
添加3 sqldatasources
页面? 那之后我该怎么办?
好吧 - 我同意你应该重构,但要回答你的问题:
由于您只是在阅读数据,因此您可以在选择中的三个表中使用联合。
示例来自http://msdn.microsoft.com/en-us/library/ms180026.aspx
SELECT ProductModelID, Name
FROM Production.ProductModel
WHERE ProductModelID NOT IN (3, 4)
UNION
SELECT ProductModelID, Name
FROM dbo.Gloves
ORDER BY Name;
GO
并修改数据源中的SelectCommand
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.