SQL 表示 vb6 的连接字符串
SQL express connection string FOR vb6
需要使用 vb6 连接 SQL 服务器 2005。
我有下面的代码..
我必须更改用户名和密码才能打开软件。
但它是在windows认证中打开的,
Public 子 OpenConn()
If Cn.State = 1 Then Cn.Close
'sql 2000 sql authentication
Cn.ConnectionString = "Provider=sqloledb; Data Source=Guru;Initial Catalog=eIntelliCabs;User Id=w[enter image description here][1]indowsusername;Password=windowsloginpassword;"
'sql 2005 /2008 express windows authetication
'Cn.ConnectionString = "Provider=sqloledb;Data Source=maity;Initial Catalog=eIntelliCabs;User Id=sa;Password=123;"
Cn.CursorLocation = adUseClient
Cn.Open
请帮助我编写代码。
要使用 SQL 身份验证,请尝试:
Cn.ConnectionString = "Provider=SQLNCLI10;Server=ServerName\SQLExpress;AttachDbFilename=c:\YourPath\mydbfile.mdf;Database=dbname;Uid=myUsername;
Pwd=myPassword;"
要使用 Trusted Security(windows 身份验证)尝试:
Cn.ConnectionString = "Provider=SQLNCLI10;Server=ServerName\SQLExpress;AttachDbFilename=c:\YourPath\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;
查看更多信息Connection Strings
需要使用 vb6 连接 SQL 服务器 2005。
我有下面的代码..
我必须更改用户名和密码才能打开软件。 但它是在windows认证中打开的,
Public 子 OpenConn()
If Cn.State = 1 Then Cn.Close
'sql 2000 sql authentication
Cn.ConnectionString = "Provider=sqloledb; Data Source=Guru;Initial Catalog=eIntelliCabs;User Id=w[enter image description here][1]indowsusername;Password=windowsloginpassword;"
'sql 2005 /2008 express windows authetication
'Cn.ConnectionString = "Provider=sqloledb;Data Source=maity;Initial Catalog=eIntelliCabs;User Id=sa;Password=123;"
Cn.CursorLocation = adUseClient
Cn.Open
请帮助我编写代码。
要使用 SQL 身份验证,请尝试:
Cn.ConnectionString = "Provider=SQLNCLI10;Server=ServerName\SQLExpress;AttachDbFilename=c:\YourPath\mydbfile.mdf;Database=dbname;Uid=myUsername;
Pwd=myPassword;"
要使用 Trusted Security(windows 身份验证)尝试:
Cn.ConnectionString = "Provider=SQLNCLI10;Server=ServerName\SQLExpress;AttachDbFilename=c:\YourPath\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;
查看更多信息Connection Strings