Link to home
Start Free TrialLog in
Avatar of Scripter25
Scripter25

asked on

DetailsView Multiple Table Insert

I am using ASP.NET DetailsView I am wanting to insert into  multiple tables with the one Insert from the Detailsview can someone please shed some light on this one for me?
Avatar of codeclay
codeclay
Flag of India image

Avatar of Lowfatspread
consider creating a view for the data ...
then have and instead of trigger on the view to handle you updates into the
individual base tables...
Avatar of Scripter25
Scripter25

ASKER

CREATE PROCEDURE dbo.Deposit

DECLARE @CheckAvailable money, @CheckBalance money, @Checking bit, @EnteredAmount smallmoney

EXECUTE dbo.GetLastValueChecking  
    @CheckAvailable OUTPUT,
    @CheckBalance OUTPUT
IF @Checking =1
BEGIN
      INSERT INTO Checking (Balance,Available)Values(@CheckBalance,@CheckAvailable)
END
ELSE
    PRINT 'Do Something.'
I tried doing this but it says syntax error near execute
sorry take that back it says Syntax Error near Declare
Look maybe this will help if I state this info first of all... I am trying to make a financial tracking site. when I enter in deposits I need to add that amount to the current balance.
Ok I have come up with a possible new solution instead of keeping my info in separate tables I can just add them together right away but if I do then I still need to be able to pull the value of the last Balance before adding it to my deposit to make the new balance insert.

Primary Key       smallmoney       smallmoney       datetime
ID       Balance       Available       date

I am using a DetailsView in Insertmode to try to accomplish this. Is this even possible?
CREATE PROCEDURE dbo.Deposit
 @CheckAvailable money
, @CheckBalance money
, @Checking bit
, @EnteredAmount smallmoney

as

SET NOCOUNT ON

EXECUTE dbo.GetLastValueChecking  -- need account or customerid????
    @CheckAvailable OUTPUT,
    @CheckBalance OUTPUT

IF @Checking =1
BEGIN
      INSERT INTO Checking (Balance,Available)Values(@CheckBalance,@CheckAvailable)
END
ELSE
    PRINT 'Do Something.'


RETURN
GO


error procedure or function "deposit" has to many arguments specified  


any ideas on that one?
ASKER CERTIFIED SOLUTION
Avatar of xiong8086
xiong8086

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial