Reputation: 2143
I'm inserting a new value using:
var message = conn.Execute("INSERT INTO [Message] (SenderId, Text, Date) values (@passeiDiretoUserId, @text, @date) SELECT SCOPE_IDENTITY()",
new { @id, @text = send.Text, @date });
The query is working fine, but I need the ID of the value that was just created. Thanks!
Upvotes: 0
Views: 393
Reputation: 172518
You are probably looking for ExecuteScalar
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Upvotes: 2