SQL code:
create
-----alter
proc AddNewAlm( @DID int ,
@UID int , @ATID int , @P1 int ,@P2 int, @SCIP nvarchar(20), @ATime datetime )
--returns int
as
begin
declare @IsHas int;
declare @AID int;
set @AID = 0;
update AlmInfoTmp set UID=UID where DID=@DID and UID=@UID and ATID=@ATID and ATPara1 = @P1 and ATPara2=@P2 ;
if @@rowcount = 0
begin
insert into AlmInfo( DID, UID, ATID, ATPara1, ATPara2, SCIP, ATime)
values( @DID, @UID, @ATID, @P1, @P2, @SCIP, @ATime ) ;
if @@rowcount > 0
insert into AlmInfoTmp( DID, UID, ATID, ATPara1, ATPara2, SCIP, ATime)
values( @DID, @UID, @ATID, @P1, @P2, @SCIP, @ATime );
set @AID = (select top 1 ID from AlmInfo where DID=@DID and UID=@UID and ATID=@ATID order by ATime DESC) ;
end
select @AID as ID;
end
上面呢是存储过程内容,是插入一条数据,然后返回这条数据的ID值
经测试,VC++怎么调用都不行,结果返回不了,用C#测试,结果可以得到,不知道哪里出现了问题
C/C++ code:
CString strSQL;
strSQL.Format("exec dbo.AddNewAlm @D