Way To Get A String Output From Stored Procedure

Sep 29, 2010

i had a stored proc: How can i get the final select statement in the code behind.

ALTER PROCEDURE [dbo].[tgms_reclass_PO_bip](@po VARCHAR(20), @old_gl VARCHAR(20), @new_gl VARCHAR(20),@output varchar(500) out )
AS
IF (SELECT COUNT(*) FROM mm2po WHERE scode = @po) = 0
BEGIN
SET @output = '1'
SET @output = 'Invalid PO Number'
END
[code]...

View 4 Replies


Similar Messages:

ADO.NET :: Stored Proc With Output Parameters / Data In The Output Parameters From The Stored Procedure?

Mar 30, 2011

I have a stored procedure that works fine for classic asp, but how can I get my output parameters data back from in /MVC 2 / linq/ entities framework model . I have inported the function also, but when i try to code it i dont get results ...i know this is a matter of lack of / knowledge or exmple because i have been scouring the web for it and cannnot find into that accually works.

here is the stored proc.

[Code]....

Here was the one of the few tries I did:

[Code]....

but it executes fine does not give me an error, but also does not return the info i need to the viewmodel

I keep seeing stuff about "ref" on the net but "ref" shows " arbument # should not be passed with the ref keyword.

So i am not sure if there is a problem with the model, or with my understanding this, Now for your info I can do the same step with returning a dataset from a stored procedure fine, but I dont want a data set I just want excatly the data in the output parameters from the stored procedure.

View 2 Replies

How To Get Values Output From Stored Procedure

Oct 26, 2010

From this below stored Procudure, using VB.Net code can i get the Values like "Number of Rows Affected" and "Yes / No" Value from "Select"Stored Procudure:ALTER PROCEDURE [dbo].[lookup] @week_date datetimeAS

DECLARE @currweek datetime, @inweek datetime
IF @week_date = '10/14/2010'
BEGIN
UPDATE dbo.work_status SET ob_flag = 0, ob_update_date = NULL WHERE dbo.work_tatus.week_date ='10/14/2010'
SELECT 'YES'
END
ELSE
SELECT 'NO'
RETURN 0

View 3 Replies

SQL Server :: How To Add An Output Parameter To A Stored Procedure

Oct 7, 2010

how do I add an output parameter to a Stored Procedure that returns a code or string to the calling app

View 1 Replies

Way To Displaying SQL Stored Procedure Output Parameter Value

Jul 30, 2010

I am having some trouble with the below code snippet. It is a stored procedure which executes on load that has an output parameter which should display in a label. Familiar which Vb however not so much in C#.

View 2 Replies

ADO.NET :: Can Pass A Value For A Output Variable In A Stored Procedure

Sep 7, 2010

I am calling a stored procedure, that exists in a SQL Server 2005 database, using ADO.NET, in which I instantiate a sql command object.

The stored procedure has an ouput variable like '@packageCode VARCHAR(100) = NULL OUTPUT'.

Can I set it's value when creating the sql command object? Or I can never set a value for an output type variable in a stored procedure?

View 5 Replies

DataSource Controls :: Way To Get Numeric Value In Stored Procedure As Output

Jun 4, 2010

i hav declare a Variable in stored procedure as@Total numeric(18,2) output..@Total Value is calculated 177.12 in stored procedure but when i return in Class.cs..its output is 177..

View 4 Replies

SQL Server :: How To Get Output As A Whole When Uasge Of Loop In Stored Procedure

Jul 19, 2010

I have written SP like this to get my required output.create procedure [dbo].[usp_gl_ProjectBudgets] set nocount on begin tran declare @SPError int

declare @y1 varchar(20)
declare @y2 varchar(20)
declare @y3 varchar(20)
declare @y4 varchar(20)
declare @y5 varchar(20)
declare @Glink int
declare @i int
set @y1='Year1'
set @y2='Year2'
set @y3='Year3'
set @y4='Year4'
set @y5='Year5'
set @Glink=1
set @i=1
[code]...

View 7 Replies

SQL Server :: Stored Procedure Output In Gridview Incorrect?

Feb 10, 2011

We had a simple Gridview that displayed a column list as Linkbuttons but we now need to display three columns as one, so I wrote a simple stored procedure to do it. However, the output in the Gridview shows duplicates and is not in order even though I specifySELECT DISTINCT in the result select as shown below.

ALTER PROCEDURE [dbo].[GetGeneralAction]
Add the parameters for the stored procedure here
AS
BEGIN
SET NOCOUNT ON;
CREATE TABLE #TempTbl (GeneralAction varchar(300) )
INSERT INTO #TempTbl (GeneralAction)
SELECT [General Action]
FROM [dbo].[Formulary2011]
INSERT INTO #TempTbl (GeneralAction)
SELECT [General Action2]
FROM [dbo].[Formulary2011]
[code]...

View 7 Replies

ADO.NET :: How To Define Date Output Parameters For A Stored Procedure

Oct 15, 2010

I have a question. How do we define date output parameters for a stored procedure?

before you answer,I should mention that I am not referring to the sql syntax definition ,which is @mydate datetime output.

This is ok,what i am asking is HOW DO I SPECIFY IT IN LINQ WHEN I NEED TO CALL THE STORED PROCEDURE IN THE SERVER SIDE CODE. I am repeating that I do I am not referring to the sql definition .

View 1 Replies

Unable To Get Stored Procedure Output Variable Through ExecuteReader

Jan 10, 2011

here my code-

using (SqlDataReader sqlDataReader = ExecuteReader(CommandType.StoredProcedure, StoredProcedures.AuthenticateUser, sqlParameter))
{
isAuthenticated = Convert.ToBoolean(sqlParameter[2].Value);
if (isAuthenticated)
{
if (sqlDataReader.Read())
{
User = new UserEntity();
DbHelper.GetEntity(sqlDataReader, User);
}
}
}

I always get isAuthenticated as false because sqlParameter[2].Value is null all the time but when I execute my query with ExecuteNonQuery it gives me the value but in that case I can not fill the entity.

View 1 Replies

DataSource Controls :: Get The Output Parameter From Stored Procedure?

May 6, 2010

I have stored procedure that increments a number. I am supposed to use the newly generated number and insert it into a table. My question is how do I execute the stored procedure, with a hardcoded value of 3 that it expects as a paramter, receive the number it generates as the output parameter and use it in the insert statement.

Here is the stored procedure code:

CREATE PROCEDURE [dbo].[Generate]
@myid int,
@next_no int output
AS
update mytable
set mynumber=mynumber + 1, @next_no = number
where myid=@myid
RETURN

Here is my insert statement, that I tried and it failed:

EXEC @GetNo = Generate '3'
Insert into customers (custid, name, phone ) values
( @GetNo, 'MSFT', '800-345-5678')

View 5 Replies

SQL Server Email Stored Procedure Need To Send Table Like Output In The Body?

Jan 10, 2011

I am creating a nightly process using a stored procedure to check for expiring records and emailing myself and the folks that need to see the information. The trouble I am having is trying to send the data in table "like" view in the message body.Here is the Proc you can see the point at which i try to use a table vairble then use it as a parameter for calling the email proc but it doesn't seem to work.

View 5 Replies

DataSource Controls :: How To Return Multiple Output Parameter From Sql Server Stored Procedure

May 5, 2010

i want to return two output parameter n temp table from sql server stored procedure

View 6 Replies

ADO.NET :: Return A String Value From Stored Procedure

Mar 19, 2011

I'm having a hard time to return a string value. I usually do this by passing an int, which works just fine. Now, I need to pass a string but couldn't. Is this possible? Or int is only type that SQL can return?

View 11 Replies

SQL Server :: Why Sql Server Stored Procedure Output Parameter Is Always Null

Aug 9, 2010

Here is my stored proc

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
Create PROCEDURE [dbo].[sp_GetNextSeq] (
@p_NextSeqNo int = NULL OUTPUT
)
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRY
BEGIN TRANSACTION
Generate Next Sequence Number
[code]...

View 7 Replies

Web Forms :: Grabbing String From Stored Procedure

Apr 9, 2010

I am having a bit of trouble pulling from a stored procedure of mine. I want to return a string, for this example I tried to grab the mail address which is a varchar in my database.

View 7 Replies

DataSource Controls :: How To Convert The Oracle Stored Procedure To Sqlserver 2005 Stored Procedure

Apr 2, 2010

This is surareddy. i nead some small clarification in the "Stored Procedure"

how to convert the oracle Stored Procedure to sqlserver2005/2008 Stored Procedure.

right now i am enhancing the project that project already developed the oracle Stored Procedure. now our company is using sqlserver 2005/2008.

how to convert the Oracle Stored Procedure to sqlserver 2005 Stored Procedure

View 4 Replies

DataSource Controls :: Do Not Use Or Call Any Stored Procedure But It Says "Could Not Find Stored Procedure 'xxxxx'?

Dec 9, 2010

Initially, I have tried to use stored procedure. But I changed my mind and preferred to call sql query in codebase with command text. However, it stills tries to find initially-called stored procedure (which is neither called or exists).I think that it is related caching. But I tried it with different browsers it did not work.What might be the reason?

View 4 Replies

DataSource Controls :: Sending A String To Stored Procedure Using An IN

May 18, 2010

I am confused here as to how to handle this. I have a stroed procedure that using the IN clause like so:

[Code]....

Now, partners can be either a single partner ID like so: 12345 or it can be many like: 12345, 22222, 33333Here is the sqlDataReader from my code:

[Code]....

When partner_list contains only one partner id like "12345" it works fine. If it has more than one then the DataReader states that there are no rows in the reader? I also tried to send the dealer list as a string with ticks, like '12345','22222','33333' but that doesnt work either.

View 6 Replies

DataSource Controls :: Stored Procedure Count To String

Jun 27, 2010

I have a several count stored procedures that are binding to gridview nicely for individual items. I now want a ful count of row so I use a stored procedure with:

[Code]....

Which works fine when testing in the DB and returns results like it should. My problem is that for the life me I cannot work how to display the results to a Label.Text or how to do it when my calendar has posted back thats where @LogDate comes from).

View 8 Replies

DataSource Controls :: Returning String Value Using Stored Procedure And Linq

Feb 7, 2010

I am having problems returning a string value through a stored procedure/linq to a label. Everything works fine if I return an integer value but I cant get a string value to bind to a label. I get the error message

Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value,
NumberFormatInfo NumberFormat) +201
Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +66
[InvalidCastException: String "System.Data.Linq.SqlClient.SqlPr" to 'Integer' is invalid‚]

This is the stored procedure
ALTER PROCEDURE test
AS
Select ProductName
From Products

This is the vb page
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim db As New DataClassesDataContext
Dim product As Integer = db.test.ToString
Label1.Text = product
End Sub

This is the aspx page
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</form>

View 1 Replies

DataSource Controls :: Passing Query String Value To Stored Procedure

Mar 30, 2010

I'm trying to pass the text value of a text box as a query string value to a stored procedure. I was hoping someone could point me in the right direction. Button Code:

[Code]....

Stored Procedure:

[Code]....

The results page datalist:

[Code]....

Code Behind of results page:

[Code]....

I'm sure i've got this entirely backwards. However if I change the NULL value in the stored procedure with some string value (eg."Donkeys") it pulls all the values that contain "Donkeys" into the datalist on my results page.

View 2 Replies

Passing Null / Empty String To Oracle Stored Procedure?

Mar 1, 2010

We have an ASP.NET web service that invokes a stored procedure on our DB (Oracle 11g). The problem is that the call to the procedure blows up every time an empty string is passed as one of the parameters. We're seeing an ORA-01084 error, which indicates to me that call is failing before the procedure is actually run.

Here's the procedure, minus some logic that I believe is not relevant:

[Code]....

As an experiment, I modified the web service to pass null rather than an empty strings. When null is passed in, I see an error indicating "wrong number or types of arguments in call to 'CREATEREPORT."

I also tried passing DBNull.Value whenever the params were null/empty, but that resulted in the error

Parameter 'p_column_id': No size set for variable length data type: String.

(Of course, p_column_id was the empty parameter in this case).

So, how can I successfully pass empty strings as parameters to my stored procedure? We definitely want to allow the p_column_id parameter to be empty.

View 1 Replies

DataSource Controls :: Execute Stored Procedure Using A String Variable

Jun 22, 2010

Is it possible to save execute stored proc command in a string variable and then execute string variable?
Does this logic fits into LINQ2SQL? Why I want to do this - INstead of passing user control references to server, I want to save user control values to string in client side java script and then pass string to server to do actual stored proc execution. Hopefully this will improve performance.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved