我正在通过Server编写一个使用数据库的应用程序。我还用了两台电脑来做。我想输入一个if语句来执行相应计算机的代码,因为我的数据库连接字符串对于每台计算机都是唯一的。每台计算机将使用相同但不同步的数据库。我只是不想来回跳来跳去改变连接字符串。
If Computer01 then
use connection-string01
else
use connection-string02
end if发布于 2016-03-15 18:11:38
此代码将返回VB.NET中计算机的名称。
Dim ComputerName As String
ComputerName = System.Net.Dns.GetHostName
If ComputerName = Computer01 Then
'Connection String 1
Else
'Connection String 2
End Ifhttps://stackoverflow.com/questions/36018719
复制相似问题