我有两点问,我需要把一个操作到一个连接的服务器上,另一个不喜欢。
Dim InvestorLookup As String = "DECLARE @investor varchar(10), @linkedserver varchar(25), @sql varchar(1000) "
InvestorLookup += "SELECT @investor = " & investor & " , @linkedserver = " & db & " , "
InvestorLookup += "@sql = SELECT * FROM OPENQUERY( +@linkedserver + , SELECT * FROM db WHERE investor = + @investor + ) EXEC(@sql)"
Dim queryInvestorLookup As SqlCommand = New SqlCommand(InvestorLookup , conn)
Dim BondNoDR As SqlDataReader = queryInvestorLookup.ExecuteReader()
Dim PasswordCheck As String = "DECLARE @investor varchar(10), @password varchar(20), @linkedserver varchar(25), @sql varchar(1000) "
PasswordCheck += "SELECT @investor = " + investor + " , @password = " + password + " , @server = " + db2 + " , "
PasswordCheck += "@sql = SELECT * FROM @server WHERE investor = @investor AND password = + @password + EXEC(@sql)"
Dim queryPasswordCheck As SqlCommand = New SqlCommand(PasswordCheck, conn)
Dim PasswordDR As SqlDataReader = queryPasswordCheck.ExecuteReader()
只要我能够告诉大家,两点问话都是一样的,但我有错误。
There is already an open DataReader associated with this Command which must be closed first.
是否有可能在两个不同的数据管理员中提出两个问题。 以后,我需要逐项参考数据,并从中选择数值。