DataSource Controls :: Grab The Value Coming From The Output Parameter?

Mar 2, 2010

My stored procedure requires an input parameter -- @CompanyName -- and has one output parameter - @CompanyID. This is how I always handled stored procedures that did NOT use output parameters. How do I grab the value coming from the output parameter?

[Code]....

View 14 Replies


Similar Messages:

Custom DataSource Extender - Where To Grab The Output Data Of The DataSource

Jun 9, 2010

I dream of creating a control which works something like this:

<asp:SqlDataSource
id="dsFoo"
runat="server"
ConnectionString="<%$ ConnectionStrings:conn %>"
SelectCommandType="StoredProcedure"
SelectCommand="cmd_foo">
</asp:SqlDataSource>
<Custom:DataViewSource
id="dvFoo"
runat="server"
rowfilter="colid > 10"
datasourceid="dsFoo">
</Custom:DataViewSource>

I can accomplish the same thing in the code behind by executing cmd_foo, loading the results into a DataTable, then loading them into a DataView with a RowFilter. The goal would be to have multiple DataViews for one DataSource with whatever special filters I wish to apply to the select portion of the DataSource. I could imagine extending this to be more powerful. I tried peaking at this and this but am a bit confused on a few points. Currently, my main issue is being unsure where to grab the output data of the DataSource so I can stick it into a DataTable.

View 1 Replies

DataSource Controls :: How To Get SP Output Parameter From ODS

Aug 4, 2010

I have a stored procedure with output parameter. I encapsulate it with Table Adapter and BLL. Call it using ObjectDataSource in conjuction with formview, just like the one in Data Access Tutorial. How do I get the output parameter in event INSERTED of the ObjectDataSource in code behind (VB)?

My stored procedure looks like this:

[Code]....

My BLL code looks like this:

[Code]....

View 2 Replies

DataSource Controls :: Output Parameter Not Getting Value?

Jul 12, 2010

We have a stored procedure which creates and returns as output the next value in line:

[Code]....

Yes, the dullards who created this system not only failed to use an identity for the primary key of this table, they then proceeded to add 1 to a varchar column to create the new value, thus insuring it can never be anything but numeric.

Sigh. I'm told we cannot address that obvious deficiency now, and we have to leave the column as varchar. Double sigh.

If I execute this sproc from SSMS, the hh_num variable is returned as expected:

[Code]....

However, when I run it through the application, the parameter I set up as output does not get its Value attribute changed:

[Code]....

I've verified that the "@hh_num" maintains its direction and name through the ExecuteNonQuery call, but its Value remains an empty string.

View 1 Replies

DataSource Controls :: How To Capture SQL OUTPUT Parameter

Oct 11, 2010

m trying to capture an output parameter from an SQL insert.for

CREATE TABLE [dbo].[Test](
[TestID] [decimal](18, 0) IDENTITY(1,1) NOT NULL,
[Test1] [int] NULL,
CONSTRAINT [PK_Test] PRIMARY KEY CLUSTERED
INSERT INTO [Test] ([Test1]) OUTPUT inserted.TestID as TestOut VALUES 1))
[code]....

View 3 Replies

DataSource Controls :: Output Parameter Always Returns 0?

Apr 15, 2010

I have a gridview that has the header row modified in order to add new records; the gridview is bound to a sqldatasource control. In my code behind, i handle the insert in the following manner:

[Code]....

I know the insert is occuring because the new record shows up in the grid after the databind, but the output parameter is not picking up the scope_identity() value...what am i doing wrong with the output parameter?

View 2 Replies

DataSource Controls :: SqlDataSource Get Output Parameter And Assign To A Var

May 22, 2010

[Code]....

How do I get the "NewID" parameter value form the above datasource and assign it to a select parameter in a different sqldatasource?

View 2 Replies

DataSource Controls :: Cannot Acces Output Parameter From Datalayer?

Dec 1, 2010

in order to allow my design to keep recently inserted record on a formview i decided to use an output parameter.Currently I have a data layer helper and a class that allows my table to have crud operations.
I have modified my insert stored procedure to the following:


ALTER PROCEDURE [dbo].[InsertContratos]
(
@Contrato int,
@Persona int,
@FechaLegalizacion datetime,
@Vendedor smallint,
@Programa smallint,
[code]...

View 3 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

DataSource Controls :: Output Parameter Not Working To Sqldatasource?

Aug 10, 2010

I am trying to get the uniqueidentifier value from a insert SP and retreive that using a sqldatasource and pass that value to store files in the relevent folder.

the SQL stored procedure

ALTER PROCEDURE [dbo].[sp_InsertIPRT]
@Site nchar(10),
@Description nvarchar(MAX),
@Application nvarchar(MAX),
@Coordinator nchar(50),
@ProjectNumber nchar(50),
@Manager nchar(50),
@DateRequested date,
@DateRequired date,
@Issues nvarchar(MAX),........

View 2 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

Web Forms :: Grab Output HTML And Write To SQL Server?

Oct 1, 2010

I've got a requirement to add a feature that will save off a dynamically created asp.net page so it can be recalled and reviewed at a later date. I was thinking of just adding a 'Save' button to the page and in the code-behind using VB to write the output HTML to a varchar(MAX) field in my database.Does anyone know how (in VB) to grab the entire page HTML so it can be inserted into a database?

View 6 Replies

DataSource Controls :: LINQ Query To Grab The Last 5 Rows From A Group?

Jan 8, 2010

i have the following objects:

Event:

- EventID (PK)
- GroupID (FK)
- StartDate

Group:

- GroupID (PK)
- GroupName

What i need to do is select the last 5 events for each group using LINQ to Objects. I tried starting with:

[Code]....

But i'm not sure how i only take the last 5 per group.

The simple way of doing this is to get the groups and then have a property on that which returns the last 5 events but if i databind this i will have to use a nested Repeater/ListView. Ideally i would like to have a row foreach event.

View 3 Replies

DataSource Controls :: Grab Unknown Parameters From Stored Procedure From Code Behind?

May 3, 2010

I am trying to allow users to grab their stored procs and call certain ones from within code. I can get the stored procedures and then fill a dropdown with them, but what I cannot find at this point is how to get the parameters that each stored procedure needs. I would like, once an SP is chosen from the dropdown to make a call to the db with that sp name and grab its paramter list so I can report what needs to be sent in to the user.

View 1 Replies

.net - Username Parameter Coming Back With More Than Gave It?

Mar 15, 2011

This is really weird - I've got a MVC app running, including a Login method in my ServicesController class:

public ActionResult Login() {
var p = Request.Params;
var userName = p["username"];
var password = p["password"];
// etc...
}

View 1 Replies

DataSource Controls :: How To Get The User Tha Have Birthday In The 7 Coming Days

Apr 20, 2010

In my user table i have birthdate fielI want get the user tha have birthday in the 7 coming days.

[Code]....

View 5 Replies

DataSource Controls :: Ienumerable For Dropdown - Loop Through The Values Coming From Function?

Feb 8, 2010

Here is my code, using LinQ to get the data from database.

public IEnumerable categoryData()
{
db = new DBModelDataContext();
var cat = from c in db.Categories
select new { c.categoryname,c.categoryid };
return cat;
}

trying to get the values (categoryname and categoryid) into textfiled and valuefield of dropdown list.

dt = new clsData();
ddlCategory.DataSource = dt.categoryData();

what is the code that i need to write to assign the categoryname to textfield and categoryid to valuefield. I mean how to loop through the values coming from the above function.

ddlCategory.DataBind();

View 2 Replies

DataSource Controls :: Doing A Data Base Lookup - Where Is The Nvarchar Size Of 4000 Coming From

Feb 18, 2011

I want to grab some values with a form and then do a lookup via a datareader in a data access class (N-Tier).

I want to return a data list and bind that to a form view control.

Here is some code from the DAL, Business object and search form.

The parameterized query doesn't like the data being passed to it from my web page .

[code]....

[Code]....

Where is the nvarchar size of 4000 coming from ?

View 9 Replies

DatabaseFactory And Output Parameter?

Mar 5, 2010

I've started using Enterprise Library and have the following questions:1)How do I add output parameter to this query and how do I get it back:

public int InsertDoc(HDocument document)
{
Database db = DatabaseFactory.CreateDatabase();
int result;
var reader = db.ExecuteNonQuery("sp_InsertDocument",
document.AddedDate,document.AddedBy, document.Title))
.
.
.
}

The db.AddOutParameter requires paremetrers that I don't have like DbCommand.2)I have a few methods that work with database (I transfer from ADO.net) stored procedures, do I have to declare : Database db = DatabaseFactory.CreateDatabase(); in each one of them or I can reuse it?

View 1 Replies

Output Parameter Into Label?

Jan 10, 2011

instead of returning my output paremeter value in my stored procedure to my label it returns the default value i set my output parameter to. why cant i put my output parameter into my text label

Dim reader As SqlDataReader
cmd.Parameters.AddWithValue("@tour", "2365")
cmd.Parameters.Add("@tourname", SqlDbType.VarChar)
cmd.Parameters("@tourname").Direction = ParameterDirection.Output

[code]...

View 1 Replies

ADO.NET :: ExecuteNonQuery With Output Parameter?

Feb 7, 2011

I am trying to return output parameter from stored procedure.

Here is my code:

protected void Button1_Click(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConn"].ConnectionString))
{
SqlCommand cmd = new SqlCommand();........

View 2 Replies

ADO.NET :: LINQ : Money Output Parameter?

Dec 14, 2010

I am using LINQ.I have stored procedure as:

ALTER PROCEDURE [dbo].[usp_ATI_OA_GetCalculatedValue]
@OredrID BIGINT = 0,
@SubTotal MONEY OUTPUT,
@ShippingTotal MONEY OUTPUT,

[code]...

The problem is that, how to return OUTPT value to dTtoal and the remaining. Because now it's show assigned values as 1, 2, 3, 4 resp. I mean the bold values.But, if I execute SP using EXEC then it works fine, shows result correctly.

View 3 Replies

SQL Server :: Get The Value Of The Output Parameter In A Webmethod?

Feb 24, 2011

I am trying to return a sum total figure from a stored procedure by using the output parameter. When I execute the stored procedure in SQL it returns 0 or a valid number like it should but when I try to use the webmethod listed below I keep getting a 0 even when I should get a valid number back.

ALTER PROCEDURE spGetCustSum
@CustomerCode CHAR(4),
@Sum AS INTEGER OUTPUT
AS
BEGIN......

Am I missing a step or have some wrong code in this method?

View 4 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







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