none
VB.net: Using LINQ with windows authentication specified in connection string RRS feed

  • Question

  • VB.net: Using LINQ with windows authentication specified in connection string

    Database admin have granted my service account access to a specific schema, however I am unable to use the app account to authenticate (in server explorer) in the data connection object as any attempt to enter a user name or password results in login failed. 

    In server explorer the tables show in the Views folder.  I attempted to write the connection string into the project code and use when calling the instance of the database, but no success thus far using multiple variations of the connection string below. 

    What I am trying to accomplish is for the end user of the application work under their current credentials and when access to the database is needed, the service account credentials would only be used to pull the data.  I haven't tried this yet with just using SQL, but am really needing to have it work with LINQ to avoid having to recode most of the project.  (Works perfect for anyone who has read-write access on their NT account)

    Private

    SubfrmDeskAnalyze_Load(sender AsObject, e AsEventArgs) HandlesMyBase.Load

    Dim cn AsString= "Data Source=SERVER;Initial Catalog=XXX_DCP;Integrated Security=False;Trusted_Connection=no; username=********; password=********;ApplicationIntent=ReadOnly"

    Dim db as new XXXBusApps(cn)

    Dim cust = from tbCust in db.Customers 'query database

    for each Person in cust

    do stuff

    next

    more stuff

    end sub



    • Edited by JL Harrison Monday, October 10, 2016 3:51 PM
    Monday, October 10, 2016 11:58 AM