VB 2010 SQL 连接的管理员权限
VB 2010 Admin Rights on SQL Connection
服务器:微软SQL服务器2008 R2
连接字符串:
MyCn.ConnectionString = "Data Source=USER-PC\SQLEXPRESS;
AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\tcogensan.mdf; " & _
"MultipleActiveResultSets=True;
User Instance=True;Integrated Security=SSPI;
Trusted_Connection=True"
MyCn.Open()
问题: 如果我不 运行 Visual Studio 作为管理员,我的连接字符串将无法工作。因此,如果我发布项目,连接字符串就会出错。我不知道要从字符串中添加或减去什么。有帮助吗?
添加信息:该项目是一个库存系统(类似 POS)。
尝试简化连接字符串:
SQLServer = "User-PCName\SQLEXPRESS" ' assumes default instance name was used at install
SQLDatabase = "tcogensan"
ConnectString = String.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", SQLServer, SQLDatabase)
如果登录失败则需要注意 server/database 的安全权限。您可以通过 SQL 服务器管理器获取数据吗?或者 Visual Studio?
服务器:微软SQL服务器2008 R2
连接字符串:
MyCn.ConnectionString = "Data Source=USER-PC\SQLEXPRESS;
AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\tcogensan.mdf; " & _
"MultipleActiveResultSets=True;
User Instance=True;Integrated Security=SSPI;
Trusted_Connection=True"
MyCn.Open()
问题: 如果我不 运行 Visual Studio 作为管理员,我的连接字符串将无法工作。因此,如果我发布项目,连接字符串就会出错。我不知道要从字符串中添加或减去什么。有帮助吗?
添加信息:该项目是一个库存系统(类似 POS)。
尝试简化连接字符串:
SQLServer = "User-PCName\SQLEXPRESS" ' assumes default instance name was used at install
SQLDatabase = "tcogensan"
ConnectString = String.Format("Data Source={0};Initial Catalog={1};Integrated Security=True", SQLServer, SQLDatabase)
如果登录失败则需要注意 server/database 的安全权限。您可以通过 SQL 服务器管理器获取数据吗?或者 Visual Studio?