如何从数据集执行插入,更新,删除

时间:2015-09-29 06:20:03

标签: c# asp.net

如何从数据集中执行插入,更新,删除,特别是从数据集执行,然后在对数据集进行CRUD操作后更新数据库.....

1 个答案:

答案 0 :(得分:0)

如果您在数据库上有表,那么您就是这样做的:

INSERT INTO [tblMGT247FeeAccruals] ([PortfolioID], [TransactionDate], [SettlementDate], [TransactionValue]) 
VALUES (@PortfolioID, @TransactionDate, @SettlementDate, @TransactionValue); SCOPE_IDENTITY())

UPDATE [tblMGT247FeeAccruals] 
SET [PortfolioID] = @PortfolioID, [TransactionDate] = @TransactionDate,   [SettlementDate] = @SettlementDate, [TransactionValue] = @TransactionValue 
WHERE AccruedFeeID = @AccruedFeeID

DELETE 
FROM tblMGT247FeeAccruals
Where AccruedFeeID = @AccruedFeeID