none
Create Multi User Login Form SQLLocalDB & VB.NET RRS feed

  • Question

  • Hello,

    I'm Creating User Login Form.Please I need your help for fulfill my requirement.

    1) With this Code I can Login. But how can I login as multi User (SA,Admin,User)?

    Public SQL As String
    Public CMD As New SqlCommand
    Public DS As New DataSet()
    Public DR As SqlDataReader
    Public DA As New SqlDataAdapter
    Public TAB As New DataTable
    
    Public K9DataConn As New SqlConnection("Data Source=-----------------")
    
    
    
    
    K9DataConn.Close()
            Try
                SQL = "select * from K9User where UName = @username and UPassword = @password"
                K9DataConn.Open()
                CMD = New SqlCommand(SQL, K9DataConn)
    
                CMD.Parameters.Add("@username", SqlDbType.VarChar).Value = FrmLogin.TxtUser.Text
                CMD.Parameters.Add("@password", SqlDbType.VarChar).Value = FrmLogin.TxtPW.Text
    
                Dim ADAP As New SqlDataAdapter(CMD)
                Dim TAB As New DataTable()
    
                ADAP.Fill(TAB)
    
                If TAB.Rows.Count <= 0 Then
                    MessageBox.Show("Username Or Password Are Invalid")
                Else
                    MessageBox.Show("Login Successfully")
    
                    FrmLogin.Hide()
                    FrmMain.Show()
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
      

    2) How to Use SASH Password for login with this 


    RohanD


    Saturday, June 8, 2019 8:04 PM

Answers

  • 1) With this Code I can Login. But how can I login as multi User (SA,Admin,User)?

    You may not see VB.NET code, but you can try a C# to VB code converter.

    https://www.red-gate.com/simple-talk/dotnet/windows-forms/controls-based-security-in-a-windows-forms-application/

    Saturday, June 8, 2019 9:03 PM
  • Hi,

    Sqlserver Authentication connection string:

    Dim ConnstrSqlServer As String = "server=servername;uid=Username;pwd=password;database=databasename"

    Windows Authentication connection string:

    Dim ConnstrWindows As String = "server=servername;database=databasename;Trusted_Connection=SSPI"

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 10, 2019 6:44 AM
    Moderator

All replies

  • 1) With this Code I can Login. But how can I login as multi User (SA,Admin,User)?

    You may not see VB.NET code, but you can try a C# to VB code converter.

    https://www.red-gate.com/simple-talk/dotnet/windows-forms/controls-based-security-in-a-windows-forms-application/

    Saturday, June 8, 2019 9:03 PM
  • Hi,

    Sqlserver Authentication connection string:

    Dim ConnstrSqlServer As String = "server=servername;uid=Username;pwd=password;database=databasename"

    Windows Authentication connection string:

    Dim ConnstrWindows As String = "server=servername;database=databasename;Trusted_Connection=SSPI"

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 10, 2019 6:44 AM
    Moderator