[英]C# Windows application: connection string to connect to remote sql server 2008 using windows authentication
I am developing a windows form application using c#. 我正在使用c#开发Windows窗体应用程序。 I want to connect to SQL Server 2008 which is in the server using windows authentication.
我想使用Windows身份验证连接到服务器中的SQL Server 2008。 Can anyone please provide me the connection string?
有人可以提供连接字符串吗?
Note: 注意:
Please help me.I am struggling for this since 3 days. 请帮助我。自3天以来,我一直在为此奋斗。
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
如果是本地的,你可以尝试一下。它将使用默认实例。我认为这会帮助你
Data Source=.;Initial Catalog=yourDBName;Integrated Security=True
I am not clear on the issue you are facing, are u running the Application on your domain cred, and you're able to access the DB? 对于您面临的问题,我不清楚,您是否在域信誉级别上运行应用程序,并且能够访问数据库? .
。 What is your current DB connection string template?
您当前的数据库连接字符串模板是什么? (3 days, seems like a long time for this issue, i must be missing something)
(3天,这个问题似乎很长一段时间,我一定很想念东西)
Follow the below steps in your visual studio, 在Visual Studio中执行以下步骤,
Then a new window will prompt which takes input like -Server Name -choose your server name (First time it will take some time to load list of server name). 然后,将出现一个新窗口,提示输入-Server Name之类的内容-选择服务器名称(第一次加载服务器名称列表会花费一些时间)。 You can get your server name by opeing SQL Server.
您可以通过运行SQL Server获得服务器名称。
option 1 - Use Windows Authentication (As this is the first time you are using, I will suggest to use this option) option 2 - use SQL Server Authentication (If your choosing this, provide your SQL Server Username and password) 选项1-使用Windows身份验证(因为这是您第一次使用,建议使用此选项)。选项2-使用SQL Server身份验证(如果选择此选项,请提供SQL Server用户名和密码)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.