Multiple Return Values

I have a situation where I need two values (both are integers) returned from a stored procedure.  (SQL 2000)

Right now, I use the statement "return @@Identity" for a single value, but there is another variable assigned in the procedure, @NewCounselingRecordID that I need to pass back to the calling class method.
I was thinking of concatenating the two values as a string and parsing them out after they are passed back to the calling method. It would look something like "21:17", with the colon character acting as a delimiter.
However, I feel this solution is kludgy. Is there a more correct way to accomplish this?
Thanks in advance for your comments.
6/2/2004 1:42:46 PM 29906 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 53
Get it on Google Play
Get it on Apple App Store

check out BOL for OUTPUT parameters..

Dinakar Nethi
Life is short. Enjoy it.
6/2/2004 2:42:54 PM
Yes, that helps....I can't believe I brain farted on output parameters.  (Duh :P)

6/2/2004 2:45:42 PM

Similar Artilces:

How do I check to see if a value returned from a sql datasource equals a listitem value
I'm trying to see if this listitem equals a value returned in my sql data source, but I get keep getting a error saying  'Item' is not a member of 'System.Web.UI.WebControls.SqlDataSource'.    How do I check if the employeeID returned is equal to the li.value? For Each li As ListItem In BillingEmployeeID.Items If li.Value = getEmployeewithMostOpenClient.Item("employeeID") ThenxxxxxxxEnd If NextNever make important decisions on a Monday! Try Items.FindByValue() or Items.FindByText() method. Something like this... string szValueFromDataso...

SQL syntax for returning multiple values from a select?
The DBI doc's seem to indicate that multiple values can be returned from an insert query. Q: insert into foo ( bar bletch ) values ( bar$seq.nextval, bletch$seq.nextval ) returning ... I've tried variations on "( bar, bletch ) into (?,?)" with and without parens and "bar into ?, bletch into ?" without any luck so far... What is the correct sql syntax (googling variations on the select returning syntax hasn't gotten me anywhere). thanx <> ...

return a value from SQL server SP back to .net
I have a SP code: select 'nothing' from tableA where userID = '123' if @@rowcount = 0 return 0 else return 1 code: Dim myConnection As New SqlConnection("server=(local);database=pubs;Trusted_Connection=yes") Dim myCommand As New SqlCommand("StoreP", myConnection) myCommand.Connection.Open() Returnvalue = myCommand.ExecuteNonQuery() myCommand.Connection.Close() Returnvalue shows -1, it doesnt show the return value from SP. how do I fix this problem? thanksmother be Hi, The return value from the ExecuteNonQuery returns the ...

ADO.NET returns different colum value when compared to View results in SQL 2005 Management Studio
I have a complex view in my sql 2005 database. The view returns a column that could be null (as the result of a left outer join). The coulmn that is returned is an integer. Everything works fine if I run the view from SQL 2005 Management Studio. My column value is always null if I use ADO.NET's SqlAdapter to return a DataTable. Has anybody seen this behaviour before? Any help appreciated. Regards, Paul. Hi Paul, From you description, I understand that when you query data from the database view, the destination column in the DataSet is always null. This could be caused by a w...

Combine sql query from multiple returns to 1 return
the following is my query, what I would like to do is show 1 line for every person instead of  potentiall many.  Most of the information is redundent except for the dates and the count of the dates and mileage.  What I would like to do is combine all the dates into one field and do a count on them for 1 tally as well as the mileage.  Here is how the information come out currently per the query.133RD       F31LFVXG      GASPERSZ       555555555      E3-6  ...

Multiple values for multiple items insert using
Hello, I have an application that allows the user to insert multiple values all related to the same item that reside in multiple tables. example base information, style general details, parts of a style etc. a single table binds them all together using foreignkeyid's. This is kind of a slow process, because they might have to create a set of styles in different colors etc on the same day. say 15 items which are different only in color. Now, I' m having to design a form which will let them insert all 15 items at once.  I dont know how to show you the lay out I have?? My idea abo...

Drop down list in Form view returns error when value in bound field (data binding
I get the following error when I click edit to edit the details in the web form:'ddlUserRestrictionType' has a SelectedValue which is invalid because it does not exist in the list of items.Parameter name: value  I would like it to accept any value which currently exists in the database. Is this easily achievable? With what you've posted, all I can tell is that you are trying to set the SelectedValue of a ddl to a value that does not exist in the list.  It would be helpful if you can post some code and the expected values of this control.~ Timwww.bucketo...

SQL,Make Multiple values for multiple columns into one column separated by comma
Hi, I'm getting the result as this Name       Class       Subject------------------------------------------Anju         10             MathsAnju         10             Physics How to write the query to get the result like this Name       Class       Subjects------------...

Returning a value From SQL
On   cmd.ExecuteNonQuery(); I am getting the following error "Procedure or function usp_Question_Count has too many arguments specified."Any Ideas as to how to fix this. Oh and I will include the SP down at the bottom        // Getting the Correct Answer from the Database.        int QuiziD = Convert.ToInt32(Session["QuizID"]);        int QuestionID = Convert.ToInt32(Session["QuestionID"]);        SqlConnection oConn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\quiz.mdf;In...

SQL return value
I have an application that calls a sp. I am not able to capture the return value (I am forcing the code not to find any records). I am not sure at what point and where to get the value returned. What is it that causes a SQL exception? Thank you. Code:  EquentialCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@RetValue", Data.SqlDbType.Char, 50)) EquentialCommand.Parameters("@RetValue").Direction = Data.ParameterDirection.Output EquentialCommand.CommandType = Data.CommandType.StoredProcedureEquentialCommand.CommandText = (&qu...

SQL query returns data, .NET returns #42S22Unknown column binding to dataset
I have a webservice with a common function which calls MYSQL and returns a dataset. Today I encounterd a strange error when performing a Select with a count() in it which I cant figure out. From a command line, the SQL query works fine and returns 9 rows... but VB.NET bombs with an error when filling the data adapter with the returned data. Please see my sample code below, is there an additional flag I need to call to make this work with VB? SQL Command Line: ( Works Great )mysql> Select taction, count(*) from kiosklogs where packageid='NewHi-Def-Test' group by taction;...

Return Value from SQL
I am trying to get the following to work, here is the stored procedureSTORED PROCEDURE (@varA varchar(25),@varb varchar(25))AS IF EXISTS (SELECT column1 FROM table1 WHERE nameA=@NameA)RETURN 01IF EXISTS (SELECT column2 FROM table1 WHERE nameB=@nameB)RETURN 02ELSE     BEGIN              INSERT INTO table1 (nameA, NameB)              VALUES (@nameA, @nameB)          RETURN 03     EN...

Returning multiple values
Hi! I use "Return var" to return a single value from my web service. So I need to know how to return multiple values instead of a single one. Can you help me? Thanks a lot. Please see below example, it could lead to solve your problem! source code at Sreedharhttp://www.w3coder.orgweblog

returning multiple values
Thanks for all your help earlier. I am doing much better now. 1/3 of my script actually passes the tests now! But I seem to be stuck again. This sub is supposed to take a string and parse it into another string and 2 integers. I get the new string back but not the integers, any ideas? It passes the first test: print "not " unless defined &parse_range; print "ok 2\n"; On the second test for this sub I get: Failed 1/1 test scripts, 0.00% okay. 1/5 subtests failed, 80.00% okay. *** Error code 29 Belinda <snip excess code> void parse_range (...

Web resources about - Multiple Return Values -

Code division multiple access - Wikipedia, the free encyclopedia
Code division multiple access ( CDMA ) is a channel access method used by various radio communication technologies. It should not be confused ...

Jakarta attacks: Multiple bombs hit Indonesian capital
ISIS has claimed responsibility for the grenades and crude homemade bombs used to stage a Paris-style attack in a busy business and shopping ...

Sopranos star Jamie-Lynn Sigler has Multiple Sclerosis
... daughter of mobster Tony Soprano on the Emmy-winning drama, has gone public with her struggle with her nearly 15-year battle with multiple sclerosis. ...

Jakarta attacks: seven dead in multiple attacks linked to Islamic State
Jakarta is on highest possible alert for terrorism, after multiple explosions hit Central Jakarta on Thursday.

Jakarta attacks: seven dead in multiple attacks linked to Islamic State
Seven people have been killed in a terrorist attack in central Jakarta, including five who are believed to be perpetrators linked to the Islamic ...

Facebook testing Material-inspired design for Messenger, multiple account sign-in support
Facebook is testing a minor Material Design-inspired refresh for its messaging app, Messenger. The addition of the floating action button (FAB) ...

Feature Request: Apple TV 4 needs a way to watch TV shows from multiple sources in one universal app
... coverage of AAPL Company , Apps , and iOS . What do you think? Discuss "Feature Request: Apple TV 4 needs a way to watch TV shows from multiple ...

Google Seeks Multiple Auto Partners for Self-Driving Car Unit
Google hopes to form partnerships with many automakers and suppliers as it develops self-driving cars to reduce traffic accidents and expand ...

Here’s what happens to your eyes when you look at multiple screens
It's more common than ever for people to stare at screens on multiple devices – some at the same time. Here's a tip for what you can do to protect ...

Multiple Explosions, Gunfire Rock Jakarta In Deadly ISIS-Claimed Attack
At least seven people died, including five assailants, a police spokeperson said. Multiple explosions and a gun battle rocked Jakarta, the capital ...

Resources last updated: 1/22/2016 9:38:27 PM