问题描述
大家好
谁能告诉我如何从远程数据库中获取信息...就像我有一个覆盖所有国家的微调器,每次我选择一个国家/地区时,它都必须填充该国家/地区下的所有省份. >
Tanx InAdvance
Hi All
Can anyone please tell me how to get a information from a remote database...like I have a spinner with all countries and everytime when i select one country it must populate all the Provinces under that country.. city likewise :)
Tanx InAdvance
推荐答案
varchar(max)
@DISTRIBUTEDDBNAME
@DISTRIBUTEDDBNAME
varchar(max)
@countryname
@countryname
varchar(max))
如
开始
声明@SQLSTATEMENT NVARCHAR(MAX)
SET @ SQLSTATEMENT =''从''+ @ SERVERNAME +''中选择省份.''+ @ DISTRIBUTEDDBNAME +''.[dbo] .TableName其中countryname = @ countryname''
EXEC SP_EXECUTESQL @SQLSTATEMENT
结束
as
begin
Declare @SQLSTATEMENT NVARCHAR(MAX)
SET @SQLSTATEMENT=''select Provinces from ''+@SERVERNAME+''.''+@DISTRIBUTEDDBNAME+''.[dbo].TableName where countryname=@countryname''
EXEC SP_EXECUTESQL @SQLSTATEMENT
end
这篇关于从远程数据库检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!