起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 225|回复: 11

【结帖】关于引用数据库存储过程**

[复制链接]
发表于 2008-5-13 17:35:01 | 显示全部楼层 |阅读模式
请教,X3上是使用的sql2005数据库需要引用另一台使用sql2000的数据库服务器的存储过程,使用的组件分别是存储过程数据集、数据源、数据感知控件!但是在打开数据集时提示以下错误:

错误提示.jpg

13.58 KB, 下载次数: 122

回复

使用道具 举报

 楼主| 发表于 2008-5-13 17:43:28 | 显示全部楼层
:1eye:  :1eye:  :1eye:  :1eye:  :1eye:
回复 支持 反对

使用道具 举报

发表于 2008-5-13 17:55:32 | 显示全部楼层
贴出你的存储过程。
回复 支持 反对

使用道具 举报

发表于 2008-5-13 17:58:15 | 显示全部楼层
似乎是jdbc驱动的问题。
楼主用的是什么jdbc驱动
把服务器端的错误信息贴出来看看
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-13 18:12:11 | 显示全部楼层
谢谢关注,正在用其他办法调试,请稍等...
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-13 18:37:41 | 显示全部楼层
应该不是存储过程的问题,服务器端没有错误,使用简单的query控件可以操作该引用的数据库中的物理表(测试的),就是调用此存储过程打开数据集时出错!这个错误在服务器是sql2000时没有,即服务器数据库是sql2000并且引用的服务器数据库也是sql2000
回复 支持 反对

使用道具 举报

发表于 2008-5-13 18:39:46 | 显示全部楼层
看1楼的错误截图,应该跟存储过程返回的数据类型有关
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-14 08:50:15 | 显示全部楼层
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go






ALTER   proc [dbo].[ScurryDetailes]
(@DateBegin DateTime,
@DateEnd DateTime
)
as
begin
if   object_id('tempdb..#tempCode')   is   not   null   
  drop table #tempCode   
  --else     
  --print   'not   exists!'
if   object_id('tempdb..#tempcityid')   is   not   null   
  drop table #tempcityid   
  --else     
  --print   'not   exists!'
if   object_id('tempdb..#ScurryDetailes')   is   not   null   
  drop table #ScurryDetailes   
  --else     
  --print   'not   exists!'
select  Parent,Code into #tempCode from dbo.Codes where Code in
                                                (select ProductCode from scurrygood)

select distinct dealcity.DealerId,dealcity.cityId,dealcity.Code1 into #tempcityid from
                (select distinct cityId,DealerCities.DealerId,tempcode.code1 from dbo.DealerCities,-- where EXISTS--DealerCities.DealerId in
                        (select distinct  Codes.DealerId,Codes.Code ,#tempCode.Code as code1
                                from dbo.Codes, #tempCode
                                where Codes.Code in
                                        (
                                                select distinct Parent from #tempCode
                                        ) and #tempCode.parent=Codes.Code
                        ) as tempcode  where DealerCities.DealerId=tempcode.DealerId
                ) as dealcity


select distinct Cities.Municipality,ScurryDetaile.ProductCode,ScurryDetaile.Mobile,ScurryDetaile.JoinTm,ScurryDetaile.DealerName,ScurryDetaile.Municipality as City
        into #ScurryDetailes
        from Cities,
        (select * from
                (select Distinct
                        ScurryGood.CityId,ScurryGood.ProductCode,ScurryGood.Mobile,ScurryGood.JoinTm,ScurryCity.DealerName,ScurryCity.CityId as CityId1,ScurryCity.Municipality
                                 from ScurryGood,
                                        (select Dealers.DealerName,TempDealerId.CityId,TempDealerId.Municipality,TempDealerId.Code1
                                         from Dealers,
                                                (select Cities.CityId,Cities.Municipality,#tempcityid.DealerId,#tempcityid.Code1
                                                        from dbo.Cities,#tempcityid
                                                        where #tempcityid.cityId=Cities.CityId
                                                ) as TempDealerId
                                        where Dealers.DealerId=TempDealerId.DealerId
                                        ) as ScurryCity  
                                where ScurryCity.Code1=ScurryGood.ProductCode
                ) as ScurryDetailes  
                where substring(cast(ScurryDetailes.CityId as varchar),1,4)<>substring(cast(ScurryDetailes.CityId1 as varchar),1,4)
        ) as ScurryDetaile
        where substring(cast(Cities.CityId as varchar),1,4)=substring(cast(ScurryDetaile.CityId as varchar),1,4)
Delete  dbo.DealertoCity
insert into DealertoCity (DealerName,City)
        select distinct   DealerName,City from #ScurryDetailes


Select aa.Municipality,aa.ProductCode,aa.Mobile,aa.JoinTm,aa.DealerName,aa.City,Codes.ProductName
from
        (select distinct #ScurryDetailes.Municipality,#ScurryDetailes.ProductCode,#ScurryDetailes.Mobile,#ScurryDetailes.JoinTm,#ScurryDetailes.DealerName,CitysID.City
        from #ScurryDetailes,
                (SELECT distinct DealerName,City=dbo.f_str(DealerName)
                 FROM DealertoCity
                         GROUP BY DealerName) as CitysID  
        where CitysID.DealerName=#ScurryDetailes.DealerName and #ScurryDetailes.JoinTm between @DateBegin and @DateEnd
        ) as aa,Codes
where aa.ProductCode=Codes.Code



if   object_id('tempdb..#tempCode')   is   not   null   
  drop table #tempCode   
  --else     
  --print   'not   exists!'
if   object_id('tempdb..#tempcityid')   is   not   null   
  drop table #tempcityid   
  --else     
  --print   'not   exists!'
if   object_id('tempdb..#ScurryDetailes')   is   not   null   
  drop table #ScurryDetailes   
  --else     
  --print   'not   exists!'
end
回复 支持 反对

使用道具 举报

发表于 2008-5-14 08:52:36 | 显示全部楼层
茄子,我远程看看。
回复 支持 反对

使用道具 举报

发表于 2008-5-14 09:42:18 | 显示全部楼层
好像是跟存储过程的参数有关。已经告诉楼主让他去测试了。
楼主,记得反馈结果
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-12 17:19 , Processed in 0.043163 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表