February 11th, 2011, 02:41 AM
Trusted connection to SQL server 2005 from WinForms App?
I know I'm going to kick myself when I get the answer to my question, but here goes anyway...
I have a SQL server with my db on it. Authentication rules, setup by the admins are set to integrated security only, with only one service account having access to the server.
I have several web apps on another server running very well using impersonation to connect to the server.
My problem is that I am currently writing a Windows service. I have created a new WinForms application that I am using to debug the code for the service before I make changes to the service code.
Anyway, The win forms app. is an exact duplicate of the code in the service, aside from the obvious differences that are required.
When I install the service on the server, I can set it's login to the service account set up for the sql server, so the connection string with trusted connection="true" in it works.
I am running the winforms app in my vb.net IDE, so I can step through the code. My windows log in account is not the same as the service account, so I get connection errors when opening my connection to the db.
How do you use impersonation in a winforms app? That is assuming that it's at all possible?
Thanks in advance.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!