Hi,
I have 'Return @@Identity' in the sp - so I think the return value is there.
I'm not sure how to use the parameters though - this is how I'm running the
sp:
Dim strConn As String = "server=" & Global.ServerName & ";database=" &
Global.DatabaseName & ";integrated security=true"
Dim objConn As New SqlConnection(strConn)
Dim objDS As New DataSet
Dim SQLInsert As String
Dim daInsertCompany As New SqlDataAdapter("spd_InsertCompany " & SQLInsert,
objConn)
daUpdateCompany.Fill(objDS)
objDS.Dispose()
daInsertCompany.Dispose()
objConn.Close()
objConn.Dispose()
Where would I add the parameters part? (Or am I running the sp incorrectly
in the first place - although it does work...)
Thanks,
Nick
"Daniel Buchholz" <ne**************@paranor.de> wrote in message
news:37*************@individual.net...
Nick wrote:
Hi,
I'm trying to add some data on a company to an SQL server (which I can
do), and want to return the FirmID (SQL identity) of the data that was
just inserted so I can use it to redirect to another page based on the
new data - which is the bit I can't do!
Can anyone point me in the right direction?
The FirmID is already the return value of the proc?
In that case just add a parameter with Direction.ReturnValue to the
parameter list of your command:
Dim myParameter As New SqlParameter()
myParameter.Direction = ParameterDirection.ReturnValue
myParameter.Value will then give you the value after the execution of the
command.
Daniel