witecloner
Well-known member
- Joined
- Feb 12, 2009
- Messages
- 45
- Programming Experience
- Beginner
Help, i have some problem when updating table using data adapter. i use sqldataadapter. here above my stored procedure code that containing multiple update table.
I have try to execute this stored proc through SQL Server Management Studio Express Edition. But i just can update customertarget table and i can not to update customer table. there is some problem in my code?
Please tell me how to use data adapter using that stored procedure?
Thank you
VB.NET:
ALTER PROCEDURE [dbo].[sp_CustomerDetail_Edit]
(
@CustomerID varchar(10),
@CustomerName varchar(50),
@Address varchar(50),
@City varchar(20),
@ContactPerson varchar(50),
@ParentID varchar(10),
@Operator varchar(10),
@Modifier timestamp OUTPUT,
@Jan money,
@Feb money,
@Mar money,
@Apr money,
@Mei money,
@Jun money,
@Jul money,
@Agt money,
@Sep money,
@Okt money,
@Nov money,
@Des money
)
AS
BEGIN
SET NOCOUNT ON
DECLARE @ERR1 int, @ERR2 int
BEGIN TRANSACTION
UPDATE Customer SET
CustomerName = @CustomerName,
Address = @Address,
City = @City,
ContactPerson = @ContactPerson,
ParentID = @ParentID,
Operator = @Operator
WHERE (CustomerID = @CustomerID) AND
(Modifier = @Modifier);
SET @ERR1 = @@ERROR
UPDATE CustomerTarget SET
Jan = @Jan,
Feb = @Feb,
Mar = @Mar,
Apr = @Apr,
Mei = @Mei,
Jun = @Jun,
Jul = @Jul,
Agt = @Agt,
Sep = @Sep,
Okt = @Okt,
Nov = @Nov,
Des = @Des
WHERE (CustomerID = @CustomerID) AND
(@ERR1 = 0);
SET @ERR2 = @@ERROR
IF @ERR1 = 0 AND @ERR2 = 0
BEGIN
COMMIT TRANSACTION
PRINT 'SUCCESS'
END
ELSE
BEGIN
ROLLBACK TRANSACTION
PRINT 'FAILED'
END
END
I have try to execute this stored proc through SQL Server Management Studio Express Edition. But i just can update customertarget table and i can not to update customer table. there is some problem in my code?
Please tell me how to use data adapter using that stored procedure?
Thank you