简体   繁体   中英

Login with VB.Net and SQL Server

I am a begginer with VB.Net and SQL Server and i want to do a Login sequence. What have in mind to me validate the user and password with SELECT COUNT but i can't put two conditions (User and Password). My Login Function is:

      Public Function Login(ByVal User As String, ByVal Pass As String) As Integer
    Dim query1 As String = ""
    Dim num1 As Integer        
    query1 = "Select Count(Us_User) from SC_User Where Us_User='" & User & "'" In this line i want to count the two things.        
    num1 = Access.LoadQuery(query1)
    Return num1
End Function

Thanks in advance. English is not my first language.

试试这种方式

query1 = "Select Count(Us_User) from SC_User Where Us_User='" & User & "' and Password='" & Pass  &"'" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM