473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

return value from stored proc using MS Data Access Application Block

How do I read a stored proc return value ( return(@return_value) )
using MS Data Access Application Block.

Normally I use:

Dim conn As SqlConnection = New
SqlConnection("connectionstring")
Dim cmd As SqlCommand = New SqlCommand
cmd.Connection = conn
cmd.CommandText = "NameOfStoredProc"
cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add("@Param1", SqlDbType.Int)
cmd.Parameters("@Param1").Value = [value]

Dim retParam As SqlParameter =
cmd.Parameters.Add("@return_value", SqlDbType.Int)
retParam.Direction = ParameterDirection.ReturnValue

conn.Open()
cmd.ExecuteNonQuery()
conn.Close()

[local var] = retParam.Value

I figure I must use SqlHelper.ExecuteScalar... but can't find out how!

Please help

Morten

Nov 19 '05 #1
0 1207

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul | last post by:
Hi, In SQL Books Online in the section on @@Error it gives the following example: -- Execute the INSERT statement. INSERT INTO authors (au_id, au_lname, au_fname, phone, address, city,...
2
by: Tim.D | last post by:
Hello people, Thanks to Serge, PM, Knut and a host of others I have now successfully completed my very first SQL Stored Procedure. Takes some 13mins or so to run, but that was expected as it...
0
by: CSDunn | last post by:
Hello, In Access ADP's that connect to SQL Server databases, any time I have a situation where I have a combo box in a main form that looks up a record in a subform, the subform record source has...
2
by: riversmithco | last post by:
Does anyone have an example of getting a return value back from a stored proc using the SqlHelper data block? This should be so easy! Here is my stored proc: CREATE PROCEDURE AddEmployee...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
2
by: philip | last post by:
hello, i am new to asp.net and sql server, and i have 3 questions for asking: 1. i am writing a store procedure of login validation for my asp.net application and wondering what the different...
8
by: jbonifacejr | last post by:
Hi. I'm sorry to bother all of you, but I have spent two days looking at code samples all over the internet, and I can not get a single one of them to work for me. I am simply trying to get a value...
2
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I can successfully insert and update the oracle database by calling a oracles stored proc from my .net code. This oracle stored proc is returning some value. I cannot see that...
8
by: colmkav | last post by:
Can someone tell me how I can access the return value of a function called from Oracle as opposed to a store proc from oracle? my oracle function is get_num_dates_varposfile. I am only used to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.