Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual Basic, Stored Procedures & SQL Server 2000

Status
Not open for further replies.

Magosoft

Programmer
Nov 9, 2001
7
GT
Hi fellows, I have this Stored Procedure on SQL Server 2000:
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Create Procedure Kardex @InputID varchar(10)
AS
Create Table #tmp (Doc varchar(10), Date datetime, InAmt int, OutAmt int, Balance int)
Insert #tmp
Select DepositID as DOC, Date, InitialQty as InAmt, 0 as OutAmt, InitialQty as Balance From Alnasa.dbo.Deposits Where InputID=@InputID
UNION Select WithdrawID, Date, 0 , WithdrawQty, 0 From Alnasa.dbo.Withdraws Where IngresoID=@IngresoID

Declare @Balance int
Set @Balance=0
Update #tmp
Set @Balance = Balance = @Balance + InAmt - OutAmt

Select * From #tmp

Drop table #tmp

GO
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
It works perfectly from Query Analizer, but when I execute it from Visual Basic Data Environment it doesn't return a recordset, and this is what I want:

Doc......Date......InAmt....OutAmt...Balance
001...01/01/2001.....150.........0......150.
002...02/01/2001.......0........50......100.
003...03/01/2001.......0........50.......50.
004...04/01/2001.......0........50........0.

Thanks

Mago
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top