Return value from Stored Procedure using ASP 3.5

 Hi,

     How come I always get the value of zero (0) when I try to return a value coming from SPro?

---

        Dim getcurrentid = _dbDataContext.getPostID(0) 'stored procedure
        Dim x As Integer = getcurrentid.ToString

ALTER PROCEDURE dbo.getPostID
(
@valueID int output
)
AS
SELECT Top 1 @valueID = fieldID FROM Table ORDER BY fieldID DESC 

---

Upon executing the SPro using VS2008 SQL Expression, it does returns the value I need.

 

cheers,

imperialx

0
imperialx
5/5/2009 12:22:27 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

2 Replies
1398 Views

Similar Articles

[PageSpeed] 46

how about change the SP

ALTER PROCEDURE dbo.getPostID
AS
SELECT Top 1 fieldID FROM Table ORDER BY fieldID DESC 

0
mo
5/5/2009 2:49:03 AM

mo meng:

how about change the SP...

 

You were right me mong!  And I have to change the declaration as well...Smile

        Dim getcurrentid = _dbDataContext.getPostID(0) 'stored procedure
        Dim x As Integer = getcurrentid.fieldID

ALTER PROCEDURE dbo.getPostID
AS
SELECT Top 1 fieldID FROM Table ORDER BY fieldID DESC  

 

cheers,

imperialx

0
imperialx
5/5/2009 5:36:39 AM
Reply:

Similar Artilces:

How to Retrive the store procedure return value in Ado.Net by using Dot Net?
Hi i am thiru. i try to create the small search engine. so that i have wrote the store procedure for it. thats given below.Create procedure FindtestThree @Name varchar(25), @Location varchar(25), @EmpId varchar(25) as select * from TbInfo where Name like + '%' + @Name + '%' select * from TbInfo where Location like + '%' + @Location + '%' select * from hi where ComName like + '%' + @EmpId + '%' Exec FindtestThree 'aa','a','d' ----------------------------------------- The above procedure return t...

Return Value when using CLR stored procedure. (Edit: For use in SQL side paging)
I have a stored procedure that I put together using the CLR.  The basic idea is the have a query that can accept any number of values.  I havent included the portion of the code that handles smalldatetime searches and I havent yet finished the logic to handle sql data type constraints but I have been working on paging using SQL's Row_Number().  The code below works but I havent been able to come up with a way to find out either how many pages the result set has or how many total rows in the result set.  I thought there might be a way to use a procedure's Return Va...

How do I use the return value from a SQL stored procedure?
I want to be able to use the returned number to set a Label accordingly.Something like this:if the return value == 1 then Label1.Text = "Correct" else Label1.Text = "Wrong" What is the correct syntax for this?  I couldn't find this answer. If you've just got one return parameter, I usually stick with ExecuteScalar. This will execute a stored procedure and return an object, which is taken from the first row and first column of whatever the stored procedure returns.So at the end of the stored procedure, after doing what you need to do, add a select stat...

PB 5.02 and MS SQL 6.5, stored procedure, SQLDBCode = 3
Hi, I'm having a problem using a cursor based on a stored procedure. When I call the sp via isql it works fine. I get approx 185 lines back. When I use PB and try to loop though the resultset I get SQLCA.SQLDBCode = 3 and SQLCA.SQLCode = 100 after a couple of iterations. No text in SQLCA.SQLErrText. How come the resultsets doesn't match? I have read to MS SQLServer manuals, but the errorcode 3 doesn't exist. Different retrival arguments gives different number of loops. I have looked at the resultset in ISQL, but I haven't found anything suspect. Anyone recognize this...

How to transfer a GUID created using vb.net into a SQL database using a stored procedure
I am able to create a guid using: Public Function GetGUID() As String ' Returns a new GUID Return System.Guid.NewGuid.ToString End Function however when I try to add this to a parameter using the following: Me.cmdSpAddOptions.Parameters("@QuoteDetailID").Value = GetGUID() I get an error, I have also tried this: Dim uidQuoteDetail As String = GetGUID() Dim myuid = New System.Guid(uidQuoteDetail) Me.cmdSpAddOptions.Parameters("@QuoteDetailID").Value = myuid but get the error "Object must implement IConvertible" A...

BUG!!!! ?? Using Stored Procedure with PB 6.5 and MS SQL Server 6.5.
I have some stored procedures on my DBMS, MS SQL Server 6.5. After upgrading to PB 6.5 I cannot assign any of my stored procedures to a datawindow. What the .... is wrong. Is it my installation? Is it PB 6.5? In fact it is serious as my reports are not running. Any comments are appreciated. Thomas Door Maersk Data AS What is the error you are getting, maybe we could help you then. Randy Thomas D��r <thd@maerskdata.dk> wrote in article <CoL4foOz9GA.276@forums.powersoft.com>... > I have some stored procedures on my DBMS, MS SQL Server 6.5. After upgrading ...

Return value from Stored Procedure #3
Hi The codes below run smoothly on my Windows Based Application BUT when I apply it on my Web Application error hit - "Operand type clash: text is incompatible with int" Dim tempRV As StringDim retValParam As New SqlClient.SqlParameter("@RETURN_VALUE", SqlDbType.Int) retValParam.Direction = ParameterDirection.ReturnValue With Conn.Command .CommandText = "usp_FProcessStdTestResult" .CommandType = CommandType.StoredProcedure .Connection = oConn.Connection .CommandTimeout = 0 .Parameters.Add(retValParam) oConn.addParam("@pUserID"...

Using values returned by stored procedure
I have called a stored procedure and bound the dataset to a repeater but I need to use elements of what is returned in textboxes. Could somebody tell me the basic syntax to put into the vb script, I have the code below so far SqlDataAdapter1.Fill(DataSet1) Repeater1.DataSource = DataSet1 Repeater1.DataBind() TextBox1.Text = Thanks hi, what does your stored procedure return? how many text box controls you need to bind with the returned values? write back so that can help. thanks.regards,Harishhttp://geekswithblogs.net/ranganh The sto...

Use Resultset Returned from a Stored Procedure in another Stored Procedure
I have a store procedure (e.g. sp_FetchOpenItems) in which I would like to call an existing stored procedure (e.g. sp_FetchAnalysts). The stored proc, sp_FetchAnalysts returns a resultset of all analysts in the system. I would like to call sp_FetchAnalysts from within sp_FetchOpenItems and insert the resultset from sp_FetchAnalysts into a local temporary table. Is this possible?  Thanks, Kevin Yes you do that with sp_executesql that is covered in the first link and if you need temp tables the second link covers some tricks of how to use them.  Hope this helps. http://support...

sql count using stored procedure withing stored procedure
I have a stored procedure that among other things needs to get a total of hours worked. These hours are totaled by another stored procedure already. I would like to call the totaling stored procedure once for each user which required a loop sort of thing for each user name in a temporary table (already done) total = result from execute totaling stored procedure Can you help with this Thanks It would be easier if you can change the stored procedure into a function. Once you do that, the total can be calculated easily with something like thisSelect Sum(dbo.CalculateHours(User...

Using a Stored Procedure to query other stored procedures and then return the results
Seems like I'm stealing all the threads here, :\ But I need to learn :) I have a StoredProcedure that needs to return values that other StoredProcedures return.Rather than have my DataAccess layer access the DB multiple times, I would like to call One stored Procedure, and have that stored procedure call the others to get the information I need. I think this way would be more efficient than accessing the DB  multiple times. One of my SP is:SELECT I.ItemDetailID, I.ItemDetailStatusID, I.ItemDetailTypeID, I.Archived,     I.Expired, I.ExpireDate, I.Deleted, S.N...

How to use the return value of a stored procedure (URGENT)
  Hi everyone, I have a stored procedure as the following:1 ALTER PROCEDURE dbo.logincheck2 @ID int,3 @Password varchar(50),4 @Result int output5 AS6 IF EXISTS (SELECT * FROM users WHERE (ID=@ID AND Password=@Password))7 BEGIN8 SET @Result=19 END10 11 ELSE12 BEGIN13 SET @Result=014 END15 16 RETURN @Result What I'm trying to do is using @result in my login.aspx.vb to check if user exists in my database. If he is, the result should be 1 and if not it should be 0. Unfortunately, I don't know how to do it. I must...

accessing stored procedure return values #3
I am trying get a return value from a stored procedure. I see a result when I use SQL Advantage, but trying to access the return value from a PD template returns nothing: query = connection.CreateQuery( "declare @next_id char(14) execute sp_msg_mgr_next_id @next_id output SELECT @next_id go" ); while ( query.MoveNext() ) { msg_id = query.GetValue( "@next_id" ); } document.WriteLn( "Message Id: " + msg_id ); Prints out 0 in PD, but in SQL Advantage I get the correct value -- Ernesto Gonzalez Web Developer Sybase Inc....

using the return value from a stored procedure in VB
 Hi guys I know this is a really common question, and I have read loads of replies on it but everything I try does not work.  I have written a small stored procedure in SQL server to upload images to a table and return the new ID using scope_identity.  I have tested it and it works fine.  here it is:*******    @siteID numeric(18,0),    @imgNum numeric(18,0),    @title NVarchar(50),    @MIMEtype nchar(10),    @imageData varbinary(max)ASBEGINSET NOCOUNT ONdeclare @imageID intINSERT INTO [site_im...

Return value in a stored Procedure using PD
Hi, I am running a stored procedure that needs to pass a value back to PowerDynamo. I have looked through the PD books on this and cannot find anything relevant to stored procedures, in the index. my connection calls the stored procedure with 3 values. The last line in stored procedure is a select stmt from a table to pull back an ID. How is that Id to be referenced in the PD code? thanks samantha PD cant handle return values or INOUT's. Dave Wolf Internet Applications Division S.Brooks <sbrooks@fnac-usa.com> wrote in message news:3899AD8A.1883C748@fnac-usa....

Web resources about - Return value from Stored Procedure using ASP 3.5 - asp.net.sql-datasource

Parliamentary procedure - Wikipedia, the free encyclopedia
... of the House of Commons of the Parliament of the United Kingdom , from which it derives its name. In the United States, parliamentary procedure ...

Rushed cosmetic procedures a 'recipe for disaster'
&#8203;When Chanelle O'Hare went searching online for a deal on potential cosmetic procedures, she could not have imagined that what she ended ...

Jetstar procedures under investigation after planes took off too heavy
Jetstar's procedures for calculating the weight of its aircraft are under review by the Australian Transport Safety Bureau after two of its planes ...

Old Lady Lawyer: Uncivil Procedure
What is some of the worst behavior you've witnesses by attorneys?

NFL Announces Changes to Officiating Procedures for Playoffs - Bleacher Report
The NFL formally approved changes to its postseason officiating procedures to allow referees the opportunity to consult Vice President of Officiating ...

We need to reform the culture of law enforcement, not just the procedures
We need to reform the culture of law enforcement, not just the procedures by digby I have a new piece up at Salon this morning about police ...

Will Paul Ryan Make His Mark As Speaker By Instituting Impeachment Procedures Against President Obama ...
Wisconsin Ayn Rand devotee Paul Ryan just started his new job as Speaker of the dysfunctional House Republicans. And he's already headed for ...

Rescued tiger cub "Himmel" dies during medical procedure - CBS News 8 - San Diego, CA News Station ...
Alpine animal rescue sanctuary Lions, Tigers & Bears is sadly reporting Himmel, the tiger cub found roaming the streets of Hemet and rescued ...

Catholic hospital allowed to deny sterilization procedure, judge says
Hospital in California argued that the procedure known as ​tubal ligation would violate its religious freedom

TSA Updates Screening Procedure, Will Mandate Some Passengers Use Full-Body Scanners
... Imaging Technologies, or AIT, in favor of full-body pat-downs by TSA agents. Under the new mandate, not everyone can opt for the pat-down procedure. ...

Resources last updated: 2/4/2016 3:13:57 AM