I want to some rows in a table , then select a specific data from the newly added record and then insert that data in another table.The following statement is obviously not working but it should give an idea of what i am trying to accomplish here.
cmd = new SqlCommand("INSERT INTO SalesDetails.sale(sale_date) VALUES (@sale_date);
SELECT sale_id FROM SalesDetails.sale WHERE sale_date=@sale_date;
SELECT stock_id FROM StockDetails.stock_item WHERE item_id=@item_id;
INSERT INTO SalesDetails.payment(payment_method,sale_id)
VALUES (@payment_method, sale_id);
INSERT INTO SalesDetails.dispatch_out_item(stock_id,sale_id,qty)
VALUES (stock_id,sale_id,@qty);", con);
outputkeyword which is explaind here