.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Enterprize library 4.1 getting output parameter after adding record in db, plz guide

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net


I need to get output parameter (flag) from db after saving record in database. I am using Microsoft Enterprise Library 4.1 for DB. I am inserting record using I Data reader.

Please guide


View Complete Post

More Related Resource Links

How to get total record count in an OUTPUT Parameter


I couldn't get the total record count in a, in my stored proc, in a given scenario. Please help


My SP looks like this:

create proc RecordCount

       @CustomerID varchar(10),

       @RecCnt int OUTPUT


begin tran

if(CustomerID = 'ABC')

@RecCnt = select count(*) from Customers where CustomerID='ABC'



begin tran


@RecCnt = select count(*) from Customers where CustomerID='XYZ' and TranDate > '05/01/2009'




-- This is how I called my SP

declare @rc int

exec RecordCount 'XYZ', @RecCnt = @rc OUTPUT

select @rc

adding parameter to query string


hi all,

how do i add a new parameter to an existing query string?


now i need to add a new parameter say, showsearch.

Help Adding Parameter at Runtime


I am getting the following error:

Must declare the scalar variable "@Approved"

Please help me debug my code.  I want to add a parameter to my SqlDataSource1 when certain controls are checked.


My Page:


<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="vacationlist.aspx.vb" Inherits="Supervisors_vacationlist" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

   <div style="position:absolute; top: 101px; left: 224px; width: 583px; height: 71px;">
       <asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" 
           RepeatDirection="Horizontal" Enabled="True">
           <asp:ListItem Selected="True">View 7 Days Out</asp:ListItem>
           <asp:ListItem>View 30 Days Out</asp:ListItem>
           <asp:ListItem>View All</as

Error adding a document library to a site



I am receiving the error "Cannot complete this action.  Please try again"  when trying to add a document library to one of the sites.  This is Sharepoint 2007 SP1.  I seem to be able to do it thru designer but not the web interface.

Does anyone know how to fix this?

output cache to be used only when parameter has changed + old question of user control not answered



i have 2 questions about output cache:

1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.

2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?

3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :


and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.

can anyone please help me?

optional output parameter in CLR Stored Procedure

I'm trying to transpose a Procedure that sends mail via CDO.Message and Ole Automation to a .Net CLR Procedure. this procedure must have the same parameters in the same order as the original to maintain compatibility with everything that already uses it. the declaration goes as follow   <Microsoft.SqlServer.Server.SqlProcedure(name:="SP_ENVIAEMAIL")> _<br/> Public Shared Sub ENVIAEMAIL(<SqlFacet(MaxSize:=100)> Optional ByVal De As String = "", <SqlFacet(MaxSize:=100)> Optional ByVal Para As String = "", _<br/> <SqlFacet(MaxSize:=100)> Optional ByVal Copia As String = "", <SqlFacet(MaxSize:=100)> Optional ByVal Oculta As String = "", _<br/> <SqlFacet(MaxSize:=100)> Optional ByVal Assunto As String = "", <SqlFacet(MaxSize:=-1)> Optional ByVal Mensagem As String = "", _<br/> <SqlFacet(MaxSize:=-1)> Optional ByVal Anexo As String = "", _<br/> <strong><SqlFacet(MaxSize:=1000)> <Out()> Optional ByVal Retorno As String = ""</strong> , _<br/> <SqlFacet(MaxSize:=100)> Optional ByVal Smtp As String = "", <SqlFacet(MaxSize:=100)> Optional ByVal Usuario As String = "",

output parameter sp/c#

 Hi I have a problem getting my code right. I got "String[1]: the Size property has an invalid size of 0." in my c# code. SP:SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE sp_GetUserName ( @UserNames UserNamesType READONLY, @tmpUserNames nvarchar(max) OUTPUT) AS BEGIN SET NOCOUNT ON; DECLARE @tmpUser nvarchar(max); SELECT @tmpUser = (FirstName + ' ' + LastName + ',') FROM Users WHERE [Login] = (SELECT UserName FROM @UserNames) SET @tmpUserNames = @tmpUser RETURN END GO   public static string GetUserName(DataTable dtUser) { string err = String.Empty; string userResult; string sqlText = "sp_GetUserName"; try { using (SqlCommand cmd = new SqlCommand(sqlText, connect.GetSqlConnection(out err))) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@UserNames", SqlDbType.Structured).Value = dtUser; cmd.Parameters.Add("@tmpUserNames", SqlDbType.Text).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); userResult = (string)cmd.Parameters["@tmpUserNames"].Value; return userResult; } } catch (SqlException ex) { return null; } } Can someon

SQL Server 2008 Stored Procedure output parameter

I would like to get OUTPUT parameter names from stored procedure without executing stored procedure.  for excample schema API will help to get input parameter metadata. Thanks in advance. Murali

Sharepoint slide library adding functionality.

The slide library in Sharepoint allows you to upload Powerpoint slides to it, then to copy a slide to a new presentation and edit it, or check it out so you can edit it and check back in the changes. Unfortunately the ability to check out multiple slides at once to edit is not possible, only the ability to copy them to a new presentation, so you lose all data stored with them.  I am trying to find a way to be able to check out multiple slides at once, then be able to check them in when you have made changes.   My questions are basically:  Can I add a button to the Sharepoint slide library interface? How can I interact with the client machine in terms of opening Powerpoint and getting them to be able to check out the slides? I have the Sharepoint VSTO tools installed and this must be for Sharepoint 2007. Thanks  

how to adding dependencies to output cache dynamically?

Suppose i have an controller action that i would like to output cache. public class HomeController : Controller    {        [OutputCache(Duration=10, VaryByParam="none")]        public ActionResult Index()        {            // set  file dependency to the cache            return View();        }    } I need to dynamically set dependency to an external file  inside the code. How can i do that?      

SP Output parameter help

Hi,I hope someone can help me with sorting this out... I'm trying to build a stored procedure that returns multiple members' names when fed their memberIds.So far this is what I've got - it works fine with one exception - I'm not sure how to write the syntax so I can get the output parameter, @MemberNames? The code below outputs the names but without a column heading. I just want the names to be a string in the output parameter @MemberNamesCREATE PROCEDURE [dbo].[sp_NameResolution] --Add the parameters for the stored procedure here @ProfileId numeric, @MemberIds varchar(8000), -- this might be a string of ids numbers like 34,56,345 @MemberNames varchar(8000) Output, @SQL AS Varchar(8000) = NULL AS BEGIN SET NOCOUNT ON; SET @SQL = 'SELECT (RTRIM(Fname) + '' '' + RTRIM(Lname)) FROM MEMBERS WHERE (MemberIds IN (' + @MemberIds + ')) AND (ProfileID = '+ CAST(@ProfileId AS VarChar)+ ')' PRINT @SQL EXEC(@SQL) END I've tried different variations like..SELECT @MemberNames = (RTRIM(Fname) + '' '' + RTRIM(Lname)) ... etcbut because I'm executing it using EXEC(@SQL) it has a cow and won't output the parameter...Any ideas?Thanks a bunch,Jason

Rounding problem for money output parameter from stored proc

I have a GridView sourced by a SQL Server stored procedure with several databound fields, including a money column for item values. My stored proc returns the data through a SELECT and everything looks good. The stored proc also has a single output parameter that sums the total value of the displayed data, and this value is displayed in a label above the GridView. The output parameter (defined as money on the SQL Server side) is passed back to the app in good shape, but is rounded when displayed in the DataSource_Selected event handler. So a total of $30,155.22 in SQL Server shows up as $30155 on my aspx.In debugging, I have confirmed that the value leaving SQL Server is correct (30155.2200), and I can see that the value coming IN to the ASP-side event handler is already rounded. What do I need to do here to coerce/force it to show as money/currency?Relevant snippets:Stored Proc:... @onHandValue money OUT...  CREATE TABLE #tempValueOnHand(... valueOnHand money )... set @onHandValue = (select round(sum(valueOnHand), 2) from #tempValueOnHand) set @onHandValue = (select sum(valueOnHand) from #tempValueOnHand)And again, the output parameter @onHandValue is coming back, just already rounded.On the ASP side:    Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSourc

adding folders to a library


I'm creating document structure whenever a document is added. Within business rules is stated that document will be added only in the 5th folder in the sturcture. So if the list name is ProjectDocuments the stucture would be


The issue is that in the custom workflow that i created only 3 folders can be added. When 4th is added SP throws an exception. Is there a setting somwhare that changes this or this is a bug?

Just to note using SP UI user can add many folders one within another.

body of the method :

private void addFolderToSubfoldersCollection(ref string folderName,SPFolderCollection subFoldersCollection )
            bool folderExists = false;
            folderName = makeNameFormated(folderName);
            foreach (SPFolder folder in subFoldersCollection)
                if (folder.Name == folderName)

Exposing data contract without passing as input or output parameter for any operation contract


I have a method in  wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.

Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?





Exposing data contract without passing as input or output parameter for any operation contract


I have a method in  wcf which returns stream of custom object. I need to deserialize this stream at client side, but my custom class which is exposed as data contract is not visible through client proxy. When I add a dummy operation contract which returns the custome object I am able to get this custom class. I dont want to write this dummy method as there are many such custom classes.

Is there any way to expose data contract without writing any operation contract that returns or accepts data contract type object?

Adding multiple users to a document library column by web service


I'm attempting to create some VB code to call a SharePoint Web Service to add a document and associated metadata to a document library. I can successfully add metadata to a text column but I'm having some problems getting multiple entries into a column which is specified to take multiple users (and does so when they are added manually) although I can get a single user in using the following snippet.

Dim info2 As MySharePoint.FieldInformation = New MySharePoint.FieldInformation()
info2.DisplayName = "Authors"
info2.InternalName = "Authors"
info2.Type = MySharePoint.FieldType.User
info2.Value = "1"

I'm hoping that someone will be able to advise me of the approach or syntax necessary to add multiple users to this Authors column e.g. Users 1 and 74. I note that

info2.Value = "1,74" or info2.Value = "1;74"

don't appear to work.

Function with output parameter



is it possible to create user define function with 3 output parameter. something like ref out parameter in C#.

Best Regards. Morteza


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend