none
Windows Forms for SQL Integration RRS feed

  • Question

  • I am trying to create a Windows Login Form to connect via Windows authentication to a SQL database and not having much luck. The examples I have come across online and Microsoft docs show how to perform a login against a "Login" table.  I am trying to perform a login against rights on the local machine.  Is there a way to perform this?  I am using visual basic on Visual Studio 2017.   Thanks in advance.
    • Moved by May Luo-MSFT Monday, December 24, 2018 7:27 AM VB issue
    Friday, December 21, 2018 3:55 PM

All replies

  • Hi dachadster13,

    Welcome to the MSDN forum.

    Based on your issue, it seems to be related with VB. Since our forum mainly focus on VS IDE issue, so I will help you move it to the VB  forum and start a new thread info for a more professional supporting.

    Thank you for your understanding.

    Br

    May


    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, December 24, 2018 7:27 AM
  • Hi,

    First you need create a login

    https://docs.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-login?view=sql-server-2017

    then you can use connection string 

    Dim constr As String = "server=.;database=mydatabasename;integrated security=SSPI"

    The server is the name of the computer running Sql Server. Since the program and the database system are on the same computer, we can replace the current computer name with . (or localhost).
    Database indicates the name of the database used (mydatabasename).
    Since we want to use integrated Windows authentication, set the integrated security to 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, December 24, 2018 8:32 AM