简体   繁体   English

将连接字符串中的驱动程序更改为VB.Net中的数据源

[英]Change the driver in the connection string to a data source in VB.Net

I have code which has the driver in a connection string. 我有在驱动程序字符串中包含驱动程序的代码。

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

Trusted_Connection=yes" Trusted_Connection =是“

I need to change that to: 我需要将其更改为:

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

Connect Timeout=30" 连接超时= 30“

When I just change the text, it gives this error: 当我只是更改文本时,它会出现此错误:

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

How do I declare the datasource? 如何声明数据源?

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; 数据源= myServerAddress;初始目录= myDataBase;用户ID = myUsername;密码= myPassword;

Use serverName\\instanceName as Data Source to connect to a specific SQL Server instance. 使用serverName \\ instanceName作为数据源连接到特定的SQL Server实例。

Are you using SQL Server 2005 Express? 您正在使用SQL Server 2005 Express吗? Don't miss the server name syntax Servername\\SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server 2005 Express installation resides. 不要错过服务器名称语法Servername \\ SQLEXPRESS,在其中您将Servername替换为SQL Server 2005 Express安装所在的计算机的名称。

visit 访问

http://www.connectionstrings.com/ http://www.connectionstrings.com/

for all types of connection strings. 适用于所有类型的连接字符串。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM