开发者

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

开发者 https://www.devze.com 2022-12-17 07:00 出处:网络
I have code which has the driver in a connection string. dim s as string = \"Driver={SQL Server}; Server=xxx\\SQLEXPRESS;

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"

I need to change that to:

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

Connect Timeout=30"

When I just change the text, it gives this error:

    [Microsoft][ODBC Driver Manager] Data source name not found a开发者_StackOverflownd 
                                     no default driver specified

How do I declare the datasource?


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

Use serverName\instanceName as Data Source to connect to a specific SQL Server instance.

Are you using 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.

visit

http://www.connectionstrings.com/

for all types of connection strings.


Don't forget your instance name, i.e., Data Source=1.2.3.4\SQLEXPRESS.

0

精彩评论

暂无评论...
验证码 换一张
取 消