vb.net中的连接到SQL数据库问题 [英] connection to sql database problems in vb.net

查看:145
本文介绍了vb.net中的连接到SQL数据库问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试使用以下连接字符串连接到sql数据库

Hi,
I''m trying to connect to an sql database using the following connection string

Dim strCon As String = "Data Source=DATABASE,2048;Initial Catalog=STUFF;User Id=domain\username; Password=12345678"



使用此方法时,我无法登录域\用户名

但是如果我使用



when using this i get login failed for domain\username

but if I use

Dim strCon As String = "Data Source=DATABASE,2048;Initial Catalog=STUFF;Trusted Connection=Yes;



那么就可以了,因为我在编码时使用自己的域登录详细信息登录了.

我需要能够在连接字符串中使用我的用户名和密码,因为我将在另一位用户的不同PC上运行该应用程序.对我们公司数据库的访问受到严格控制,因此我无法获得其他用户的访问.
连接字符串中还需要其他内容吗?

谢谢
J



then is works fine as i am logged in under my own domain login details while coding.

I need to be able to use my username and password in the connection string as i will be running the application on a different pc under another user. Access to the databases in our company a strictly controlled so I can''t get access for the other users.
Is there something else I need in the connection string.

Thanks
J

推荐答案

是的,需要访问 http://www.connectionstrings.com/ [^ ].

祝你有美好的一天.
Yes, need to visit http://www.connectionstrings.com/[^].

Have a nice day.


"Data Source=ServerName;Initial Catalog=DatabaseName;User Id=username; Password=password"


祝您编码愉快!
:)


Happy Coding!
:)


试试看,

Hi Try this,

Data Source=.\data123;Initial Catalog=DBDesign;Integrated Security=True;Integrated Security=True;User ID=sa;Password=*****" providerName="System.Data.SqlClient"



编码愉快....



Happy coding....


这篇关于vb.net中的连接到SQL数据库问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆