Click here to Skip to main content
16,016,489 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I would need your help. I have a project that I need to insert multiple records into my table. Here is more detail.
I design a purchase order table and purchaseorderdetails
purchaseorder
PURCHASE_ORDER_ID
PO_DATE
CLIENT_ID
purchaseorderdetails
PURCHASE_ORDER_DETAILS_ID
PURCHASE_ORDER_ID
ITEM_ID
ITEM_AMOUNT
Could you please send me the stored procedure that allows how to have multiple records insert into
Posted
Updated 21-Aug-12 11:57am
v2

hi,

this may be useful for u

SQL
DECLARE @ID int

BEGIN TRANSACTION 
INSERT INTO tbl_user_login VALUES (@UserID, @Pass, @Enabled, @Permission, @Rank)

SET @ID = SCOPE_IDENTITY()    
IF @@ERROR <> 0
BEGIN      
    ROLLBACK     
    RETURN 
END   

INSERT INTO tbl_user_profile VALUES (@ID, @FName, @LName, @Phone, @Email1, @Email2) 

IF @@ERROR <> 0 
BEGIN     
    ROLLBACK     
    RETURN 
END  

COMMIT
 
Share this answer
 
v2
When executing the SQL statement from the client side, wrap them inside a MySqlTransaction[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900