Anyone know why I'm always getting 0 returned? My stored procedure
returns -1.
Dim iErrorCode As Int32
iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.st rConn, _
"gpUpdateMember", _
Convert.ToInt32(lblMember_id.Text), _
-snip-
-Max 6 3485
ExecuteScalar: Executes the query, and returns the first column of the
first row in the result set returned by the query. Extra columns or rows are
ignored.
What were you expecting back?
"Max" <no****@notvalid.com> wrote in message
news:uA**************@tk2msftngp13.phx.gbl... Anyone know why I'm always getting 0 returned? My stored procedure returns -1.
Dim iErrorCode As Int32 iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.st rConn, _ "gpUpdateMember", _ Convert.ToInt32(lblMember_id.Text), _ -snip-
-Max
In my stored proc I have return @errorcode or return -1
I thought ExecuteScalar was for getting a single value...
"Scott M." <s-***@nospam.nospam> wrote in message
news:uT**************@tk2msftngp13.phx.gbl... ExecuteScalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
What were you expecting back?
"Max" <no****@notvalid.com> wrote in message news:uA**************@tk2msftngp13.phx.gbl... Anyone know why I'm always getting 0 returned? My stored procedure returns -1.
Dim iErrorCode As Int32 iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.st rConn, _ "gpUpdateMember", _ Convert.ToInt32(lblMember_id.Text), _ -snip-
-Max
To get a Return value you have to use a parameter...
cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int).Direction =
ParameterDirection.ReturnValue
....
Dim retval as integer = CInt(cmd.Parameters("RETURN_VALUE").Value)
HTH,
Greg
"Max" <no****@notvalid.com> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl... In my stored proc I have return @errorcode or return -1
I thought ExecuteScalar was for getting a single value... "Scott M." <s-***@nospam.nospam> wrote in message news:uT**************@tk2msftngp13.phx.gbl... ExecuteScalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
What were you expecting back?
"Max" <no****@notvalid.com> wrote in message news:uA**************@tk2msftngp13.phx.gbl... Anyone know why I'm always getting 0 returned? My stored procedure returns -1.
Dim iErrorCode As Int32 iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.st rConn, _ "gpUpdateMember", _ Convert.ToInt32(lblMember_id.Text), _ -snip-
-Max
Thanks I know that works, but principally speaking I swore I could return a
value with ExecuteScalar. I think it's my return statement in the stored
procedure...
something like...
RETURN SELECT @errorcode
or..
RETURN SELECT myvar = @errorcode
Something that returns a recordset, but it doesn't...
Thanks for your guys help!
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP15.phx.gbl... To get a Return value you have to use a parameter...
cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue ... Dim retval as integer = CInt(cmd.Parameters("RETURN_VALUE").Value)
HTH, Greg
"Max" <no****@notvalid.com> wrote in message news:eh**************@TK2MSFTNGP09.phx.gbl... In my stored proc I have return @errorcode or return -1
I thought ExecuteScalar was for getting a single value... "Scott M." <s-***@nospam.nospam> wrote in message news:uT**************@tk2msftngp13.phx.gbl... ExecuteScalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
What were you expecting back?
"Max" <no****@notvalid.com> wrote in message news:uA**************@tk2msftngp13.phx.gbl... Anyone know why I'm always getting 0 returned? My stored procedure returns -1.
Dim iErrorCode As Int32 iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.st rConn, _ "gpUpdateMember", _ Convert.ToInt32(lblMember_id.Text), _ -snip-
-Max
You almost got it, just drop the RETURN part
SELECT @errorcode
Greg
"Max" <no****@notvalid.com> wrote in message
news:ei***************@TK2MSFTNGP11.phx.gbl... Thanks I know that works, but principally speaking I swore I could return a value with ExecuteScalar. I think it's my return statement in the stored procedure...
something like... RETURN SELECT @errorcode or.. RETURN SELECT myvar = @errorcode
Something that returns a recordset, but it doesn't...
Thanks for your guys help! "Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message news:eb**************@TK2MSFTNGP15.phx.gbl... To get a Return value you have to use a parameter...
cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue ... Dim retval as integer = CInt(cmd.Parameters("RETURN_VALUE").Value)
HTH, Greg
"Max" <no****@notvalid.com> wrote in message news:eh**************@TK2MSFTNGP09.phx.gbl... In my stored proc I have return @errorcode or return -1
I thought ExecuteScalar was for getting a single value... "Scott M." <s-***@nospam.nospam> wrote in message news:uT**************@tk2msftngp13.phx.gbl... ExecuteScalar: Executes the query, and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
What were you expecting back?
"Max" <no****@notvalid.com> wrote in message news:uA**************@tk2msftngp13.phx.gbl... > Anyone know why I'm always getting 0 returned? My stored procedure > returns -1. > > Dim iErrorCode As Int32 > iErrorCode = Convert.ToInt32(SqlHelper.ExecuteScalar(AppVars.st rConn, > _ > "gpUpdateMember", _ > Convert.ToInt32(lblMember_id.Text), _ > -snip- > > -Max >
I think you're right! lol! This tells me I need to get a book on tsql
instead of relying on samples and quick start guides.
Thanks!
-Max
"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... You almost got it, just drop the RETURN part
SELECT @errorcode
Greg
"Max" <no****@notvalid.com> wrote in message news:ei***************@TK2MSFTNGP11.phx.gbl... Thanks I know that works, but principally speaking I swore I could return a value with ExecuteScalar. I think it's my return statement in the stored procedure...
something like... RETURN SELECT @errorcode or.. RETURN SELECT myvar = @errorcode
Something that returns a recordset, but it doesn't...
Thanks for your guys help! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Punit |
last post by:
Hi,
Could someone please suggest where I am going wrong... Iam using MSXML
3.0 and VC++ but i end up getting blank response XML
try
{
hr =...
|
by: JDC |
last post by:
Hi all,
Is there a recommended way (i.e. not a bodge) to get a GridView to
always display decimal numbers using a dot as the decimal separator,
regardless of the locale the user is viewing the...
|
by: pm1ccc |
last post by:
Hi,
I have written following code and not getting back values in the same form ( i have used phpself)
<?php
$Fname = $_POST;
$Lname = $_POST;
$gender = $_POST;
$food = $_POST;
$quote =...
|
by: simbarashe |
last post by:
Hie
could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as...
|
by: =?Utf-8?B?R3lhbmVuZHJh?= |
last post by:
I am using Ajax control(Update Panel) in my web page(ASP.Net 2.0) and putting
Report Viewer(Sql Server Reporting Services 2005) Control in it.
When I am displaying any report it is coming...
|
by: programmerboy |
last post by:
This questions is pretty easy, but let me ask since I wasn't able to figure it out.
why I am always getting the first value from DropDownList when I have
ddlStates.SelectedItem.Value;
...
|
by: Chuck Anderson |
last post by:
I am trying to use ImageMagick to create thumbnails on the fly - without
having to save the image to a file.
I have gotten it to work by using passthru($cmd, $retval), but I want to
use...
|
by: manoj9849967222 |
last post by:
Hi All
I have a great problem.
I have three tables one is "SALES" other one is "Purchase" & "Productid"
Now i want to get the closing stock out of it.
Say productid is 1.2 ---------...
|
by: Christian Heimes |
last post by:
Grant Edwards wrote:
It's dangerous to mix streams and descriptors. Traditionally freopen()
is used to redirect a standard stream to a file:
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |