0
我工作在C#項目,並正在執行這一說法,但沒有得到帶回點什麼(用數據表來找回數據)SQL服務器 - 複合語句
string SQL =
"DECLARE @NewID int; SELECT TOP 1 @NewID = [ItemID] + 1 FROM [GroupItems] ORDER BY [ItemID] DESC; " +
"INSERT INTO [GroupItems] ([InstanceID], [ItemID], [GroupID], [ItemName], [DisplayName], [Units], [Updated]) " +
"VALUES(@instanceID, @NewID, @groupID, @name, @display, @units, CURRENT_TIMESTAMP); SELECT * FROM [GroupItems] WHERE [ItemID][email protected]";
基本上我想做的是返回我剛剛創建的行。任何幫助?
此查詢在SQL Management Studio Express中正常工作嗎? – Sudantha
也許添加執行查詢的代碼? – Andomar
你可以發佈組項目表的結構嗎?如果您將最後一行更改爲SELECT 1,您是否返回1 ... – Sparky