out prameter to store procedure in vb.net
-
hi expert i have created one table in mysql database the field name is ex. id,name,address so i want insert name and address in table by store procedure and get value of id by out parameter. name is in parameter address is in parameter id is out parameter
-
hi expert i have created one table in mysql database the field name is ex. id,name,address so i want insert name and address in table by store procedure and get value of id by out parameter. name is in parameter address is in parameter id is out parameter
Con.Open()
'Transaction = Con.BeginTransaction()
Dim cmd As New SqlCommand("SP", Con)
cmd.CommandType = CommandType.StoredProcedure
cmd.ExecuteNonQuery()
Variable = cmd.Parameters("@ID").Value
'Transaction.Commit()
Con.Close()Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it
-
Con.Open()
'Transaction = Con.BeginTransaction()
Dim cmd As New SqlCommand("SP", Con)
cmd.CommandType = CommandType.StoredProcedure
cmd.ExecuteNonQuery()
Variable = cmd.Parameters("@ID").Value
'Transaction.Commit()
Con.Close()Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it
That's great, if only it would work.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
hi expert i have created one table in mysql database the field name is ex. id,name,address so i want insert name and address in table by store procedure and get value of id by out parameter. name is in parameter address is in parameter id is out parameter
When you add your parameters to the code for the proc, make sure you create the parameter explicitly, then add it to the list. That way, you can also set the Direction property ( from memory ) to specify it's an Out parameter. Then check the value on that variable after calling the procedure.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
That's great, if only it would work.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
When you add your parameters to the code for the proc, make sure you create the parameter explicitly, then add it to the list. That way, you can also set the Direction property ( from memory ) to specify it's an Out parameter. Then check the value on that variable after calling the procedure.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Thanks, Yes you are right , like this cmd.Parameters.Add(New SqlParameter("@ID", SqlDbType.Int, 9, ParameterDirection.Output, False, 18, 0, "ID", DataRowVersion.Current, CInt(mCls.EM_ID)))
Best Of Regards, SOFTDEV If you have knowledge, let others light their candles at it