2010-01-25 36 views
0

我有代码在连接字符串中包含驱动程序。将连接字符串中的驱动程序更改为VB.Net中的数据源

dim s as string = "Driver={SQL Server}; 
Server=xxx\SQLEXPRESS; 
Database=dbRegister; 

Trusted_Connection =是”

我需要更改到:

data source=1.2.3.4; 
user id=xx; 
password=xxxxx; 
initial catalog=xxxxx; 

连接超时= 30"

当我刚刚更改的文本,它给出了这样的错误:

[Microsoft][ODBC Driver Manager] Data source name not found and 
            no default driver specified 

我如何声明数据源?

+0

好奇,改变这个的动机是什么? – JonathanK 2010-01-25 18:08:16

回答

0

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

使用serverName \ instanceName作为数据源连接到特定的SQL Server实例。

您使用SQL Server 2005 Express吗?不要错过服务器名称语法Servername \ SQLEXPRESS,其中您将Servername替换为SQL Server 2005 Express安装所在的计算机的名称。

访问

http://www.connectionstrings.com/

所有类型的连接字符串。

0

不要忘记您的实例名称,即Data Source=1.2.3.4\SQLEXPRESS

相关问题