B
Blue Streak
Hi, Folks!
This is a basic question. I'm just having a brain freeze and can't
figure out how to it.
I have a stored procedure like (SQL2005):
CREATE PROCEDURE [dbo].[sp_INSERT] (...)
AS
INSERT INTO Table (...)
VALUES (...)
SELECT @@IDENTITY AS ID
and in my behind code I have some thing like:
Dim sqltmp As String
....
sqltmp = "sp_INSERT ..."
SqlDataSource.InsertCommand = sqltmp
SqlDataSource.InsertCommandType = SqlDataSourceCommandType.Text
'Commit to database ... or bust!
Try
MessageLabel.Text = SqlDataSource.Insert() & " record inserted."
Catch ex As Exception
MessageLabel.Text = sqltmp & " " & ex.Message
End Try
....
How do I capture the @@IDENTITY from the returned ID field after an
INSERT command?
TIA...
This is a basic question. I'm just having a brain freeze and can't
figure out how to it.
I have a stored procedure like (SQL2005):
CREATE PROCEDURE [dbo].[sp_INSERT] (...)
AS
INSERT INTO Table (...)
VALUES (...)
SELECT @@IDENTITY AS ID
and in my behind code I have some thing like:
Dim sqltmp As String
....
sqltmp = "sp_INSERT ..."
SqlDataSource.InsertCommand = sqltmp
SqlDataSource.InsertCommandType = SqlDataSourceCommandType.Text
'Commit to database ... or bust!
Try
MessageLabel.Text = SqlDataSource.Insert() & " record inserted."
Catch ex As Exception
MessageLabel.Text = sqltmp & " " & ex.Message
End Try
....
How do I capture the @@IDENTITY from the returned ID field after an
INSERT command?
TIA...