A
aussie rules
Hi,
I have a stored proc that inserts a record into a table, with an identity
value.
In my stored proc I return this value with the following code :
set @Pr_ID = @@IDENTITY
return @Pr_ID
I can see using the SQL Profile(as well executing the cmd in SQL Query
Analyzer), that the correct value is being returned.
My problem is 'getting' this value back in my VB.Net code.
the following code returns a 0 value. What is this code doing wrong. Is
executescalar not the proper way to do this ?
Thanks
.......
Dim myParm As SqlParameter = oCmd.Parameters.Add("@Pr_ID", SqlDbType.Int, 4,
SavedPr)
myParm.Direction = ParameterDirection.Output
SavedPr= oCmd.ExecuteScalar()
.........
I have a stored proc that inserts a record into a table, with an identity
value.
In my stored proc I return this value with the following code :
set @Pr_ID = @@IDENTITY
return @Pr_ID
I can see using the SQL Profile(as well executing the cmd in SQL Query
Analyzer), that the correct value is being returned.
My problem is 'getting' this value back in my VB.Net code.
the following code returns a 0 value. What is this code doing wrong. Is
executescalar not the proper way to do this ?
Thanks
.......
Dim myParm As SqlParameter = oCmd.Parameters.Add("@Pr_ID", SqlDbType.Int, 4,
SavedPr)
myParm.Direction = ParameterDirection.Output
SavedPr= oCmd.ExecuteScalar()
.........