存储过程在客户端不能执行,请高手指教!!
我下面这段存储过程在SQL服务器执行没有问题,插入增加修改的纪录都有,但在另外的机器客户端通过VB调用该存储过程,也能通过,但纪录集里没有纪录,为空的,客户端看到的是空的。请高手指点我的存储过程问题在哪。万分感谢。SET ANSI_NULLS ON  
SET ANSI_WARNINGS ON  
SET nocount ONGOCREATE PROCEDURE [S_Pinvoice_in] 
@Date_Y char(4),@Date_M char(2)  ASif @Date_Y is null
    print '@Date_Y is null  'delete from invhead_B 
delete from invinterhead_B insert into invhead_B  (chkno,Pay,payamt,PayDate,Tamt,cus_id,Cus,inv,invdate,ReturnAmt,DeductAmt,insu,frei,other,sold_to,ship_to,,Term)
SELECT   chkno,Pay,payamt,PayDate,Tamt,cus_id,Cus,inv,invdate,ReturnAmt,DeductAmt,insu,frei,other,sold_to,ship_to,,Term 
   FROM      OPENDATASOURCE(
         'SQLOLEDB.1',
         'Provider= SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=invoice;Data Source=Ming'
         ).数据库名.dbo.invhead where year(invdate)=@Date_Y  and month(invdate)=@Date_Mupdate invhead_B set  date_due=invdate+b.date_add   from invhead_B a,term b
 where a.term=b.term  
insert into invinterhead_B  (chkno,Pay,payamt,PayDate,Tamt,cus_id,Cus,inv,invdate,ReturnAmt,DeductAmt,insu,frei,other,sold_to,ship_to,,Term)
SELECT   chkno,Pay,payamt,PayDate,Tamt,cus_id,Cus,inv,invdate,ReturnAmt,DeductAmt,insu,frei,other,sold_to,ship_to,,Term 
   FROM      OPENDATASOURCE(
         'SQLOLEDB.1',
         'Provider= SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=invoice;Data Source=Ming'
         ).数据库名.dbo.invinterhead where year(invdate)=@Date_Y  and month(invdate)=@Date_MGO

解决方案 »

  1.   

    'Provider= SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=invoice;Data Source=Ming'
      

  2.   

    在客户端,能访问Ming的invoice数据库吗?用同一个内网的网络用户名登录
      

  3.   

    可以的,会不会是OPENDATASOURCE()的影响。
      

  4.   

    在存储过程中用select 语句,客户端调用时能否返回记录集。SELECT   chkno,Pay,payamt,PayDate,Tamt,cus_id,Cus,inv,invdate,ReturnAmt,DeductAmt,insu,frei,other,sold_to,ship_to,,Term 
       FROM      OPENDATASOURCE(
             'SQLOLEDB.1',
             'Provider= SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=invoice;Data Source=Ming'
             ).数据库名.dbo.invhead where year(invdate)=@Date_Y  and month(invdate)=@Date_M