Hi
I want to get the rerurn value from a stored procedure
My stored proc looks like this
create proc test
.....
if..
return 1
else
if ..
return 2
else
..return 0
I'm using the SqlHelper.Execu teNonQuery and pass the procedure name,
connection and an array of parameters. How I do I get the return value
from this. If I create a parameter of Diretion ReturnValue and include
in the parameter array, I get an error that the parameters don't match.
WHat is the correct way of doing?
Regards
RJN
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! 7 7546
Hi,
Use ExecuteScalar instead. http://msdn.microsoft.com/library/de...calartopic.asp
Ken
-------------------------
"RJN" <rj*@yahoo.co m> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
Hi
I want to get the rerurn value from a stored procedure
My stored proc looks like this
create proc test
.....
if..
return 1
else
if ..
return 2
else
..return 0
I'm using the SqlHelper.Execu teNonQuery and pass the procedure name,
connection and an array of parameters. How I do I get the return value
from this. If I create a parameter of Diretion ReturnValue and include
in the parameter array, I get an error that the parameters don't match.
WHat is the correct way of doing?
Regards
RJN
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Use executeScalar to return a ret val. ExecuteNonQuery would be for
something like "set transaction isolation level read uncommitted" or
similar.
hth
Eric
RJN wrote: Hi
I want to get the rerurn value from a stored procedure
My stored proc looks like this
create proc test .... if.. return 1 else if .. return 2 else ..return 0
I'm using the SqlHelper.Execu teNonQuery and pass the procedure name, connection and an array of parameters. How I do I get the return value from this. If I create a parameter of Diretion ReturnValue and include in the parameter array, I get an error that the parameters don't match. WHat is the correct way of doing?
Regards
RJN
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
"Eric Sabine" <mopar41@mail_a fter_hot_not_be fore.com> wrote in message
news:e3******** ******@TK2MSFTN GP15.phx.gbl... Use executeScalar to return a ret val. ExecuteNonQuery would be for something like "set transaction isolation level read uncommitted" or similar.
....or something less exotic like INSERT, UPDATE, or DELETE.
Jeff Johnson wrote: "Eric Sabine" <mopar41@mail_a fter_hot_not_be fore.com> wrote in message news:e3******** ******@TK2MSFTN GP15.phx.gbl...
Use executeScalar to return a ret val. ExecuteNonQuery would be for something like "set transaction isolation level read uncommitted" or similar.
...or something less exotic like INSERT, UPDATE, or DELETE.
LOL
Forgot to mention that I'm having update statements in the stored proc
so i can't use ExecuteScalar
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
True, but DML from the front-end is bad practice. Stored procedures should
be the only means of DML.
Jeff Johnson wrote: "Eric Sabine" <mopar41@mail_a fter_hot_not_be fore.com> wrote in message news:e3******** ******@TK2MSFTN GP15.phx.gbl...
Use executeScalar to return a ret val. ExecuteNonQuery would be for something like "set transaction isolation level read uncommitted" or similar.
...or something less exotic like INSERT, UPDATE, or DELETE.
Hi,
I guess an output parameter is your only option. http://support.microsoft.com/default...b;en-us;308049
Ken
---------------
"RJN" <rj*@yahoo.co m> wrote in message
news:Oo******** ******@TK2MSFTN GP10.phx.gbl...
Forgot to mention that I'm having update statements in the stored proc
so i can't use ExecuteScalar
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian |
last post by:
I am trying to pass a null value into a stored procedure
so that it can save the data. I am using Microsoft's
SQLHelper dll to do this. My example code is below. How
do I pass in a null value as a parameter? For example, in
the code below, miVendorID is declared as an Object. The
save attempt fails if the object has not been populated
(for example, the person choose not to select a vendor
from the dropdown list) I have the same...
|
by: Alpha |
last post by:
I have a Window based application that shows up still running in the task
manager when I close it. It reaches the "this.close" statement and then it
stops at the "}" at the section of the following code after the
"Application.Run(new VMSMain());":
static void Main()
{
Application.Run(new VMSMain());
}
|
by: Neven Klofutar |
last post by:
Hi,
I have a problem with SqlHelper.ExecuteScalar ...
When I try to execute SqlHelper.ExecuteScalar I get this message:
"System.InvalidCastException: Object must implement IConvertible.".
Help ...
Thanx, Neven
|
by: Tim::.. |
last post by:
Can someone please help....
I'm having major issues with a user control I'm tring to create!
I an trying to execute a sub called UploadData() from a user control which I
managed to do but for some reason I keep getting the error:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
|
by: Shapper |
last post by:
Hello,
I have created 3 functions to insert, update and delete an Access
database record. The Insert and the Delete code are working fine.
The update is not. I checked and my database has all the necessary
records in it when testing it. I get the error "No value given for one
or more required parameters." when I try to update the database.
Can you tell me what am I doing wrong?
| |
by: Adriano |
last post by:
Hello,
when I try to print something, either DataGrid or from Crystal Report viever
the folowing error message appears and cancels printing:
Object reference not set to an instance of an object :((((
Anyone pls help me to solve this problem!!!
thanks in advance,
|
by: Manuel |
last post by:
I'm using the SQLHelper class to do an insert and get the identity field
this way:
--------------
Dim sql As String = "INSERT INTO () VALUES
('MyMessage');SELECT SCOPE_IDENTITY()"
Dim ds As Data.DataSet = SqlHelper.ExecuteDataset(ConnectionString,
Data.CommandType.Text, sql)
Dim MsgID As Integer = ds.Tables(0).Rows(0).Item(0).ToString
--------------
|
by: John F |
last post by:
Hello All,
What is the consensus on using sqlhelper or not using sqlhelper when calling
stored procedures?
We're trying to go with a standard for our projects and personally I prefer
not using sqlhelper, but some here do. I'm just curious if there are any
good arguments for or against it...
Thanks,
|
by: =?Utf-8?B?Ymlj?= |
last post by:
Hi,
Calling my method below how does my page caller display the exception since
the return type is int?
int ret = 0;
string spname = "sp_UpdateAd";
try
{
//Retrieve the parameters from the cache
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |