L
Luc
Hi,
i do an insert in the aspx file from a detailsview.
Now i need the 'id' of the record just inserted.
How can i do that?
I tried this, but the two sql statements are of course disconnected and it
doesn't work.
Thanks for help
Luc
code-behind
------------
Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
DetailsView1.ItemInserted
Dim sql As String
Dim comd As SqlCommand
Dim id As Integer
Using mConnection As New SqlConnection(param.ConnectionString)
sql = "Select SCOPE_IDENTITY()"
comd = New SqlCommand(sql, mConnection)
mConnection.Open()
id = comd.ExecuteScalar
End Using
....
aspx file
i do an insert in the aspx file from a detailsview.
Now i need the 'id' of the record just inserted.
How can i do that?
I tried this, but the two sql statements are of course disconnected and it
doesn't work.
Thanks for help
Luc
code-behind
------------
Protected Sub DetailsView1_ItemInserted(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles
DetailsView1.ItemInserted
Dim sql As String
Dim comd As SqlCommand
Dim id As Integer
Using mConnection As New SqlConnection(param.ConnectionString)
sql = "Select SCOPE_IDENTITY()"
comd = New SqlCommand(sql, mConnection)
mConnection.Open()
id = comd.ExecuteScalar
End Using
....
aspx file