SQL Server :: How To Receive An Output Resultset From A Sproc
Dec 26, 2010
i want to get first picture of any album in photo table. i want get output table for show to the datalist control.i need to get albumid in output
so i create a sproc similar this:
create PROC USP_GETFirstPhoto
@ALBUMID INT OUTPUT,
@CATEGORY NVARCHAR(50) OUTPUT ,
@CAPTION NVARCHAR(50) OUTPUT
AS
SELECT @ALBUMID = A.AlbumID,@CATEGORY=A.Category,@CAPTION=TMP.Caption FROM Albums A
CROSS APPLY
( SELECT top 1 * FROM Photos
WHERE AlbumID=A.AlbumID
)TMP
order by A.AlbumID
DECLARE @x INT,@y NVARCHAR(50),@z NVARCHAR(50)
EXEC USP_GETFirstPhoto @x output,@y output,@z output
select @x,@y,@z
but when i exec this proc i have a recorde not a result set
with this query i have resultset
SELECT * FROM Photos
CROSS APPLY (
SELECT TOP 1 AlbumID FROM Photos
GROUP BY AlbumID)TMP
View 16 Replies
Similar Messages:
Jan 9, 2011
[Code]....
pass values to sproc from sproc?
View 6 Replies
Sep 6, 2010
I want to combine two queries like :
select name as name1 from table1 where id = 6
and
select name as name2 from table1 where id = 2.
I need a single resultset. How can I do that?
View 26 Replies
Aug 24, 2010
I've a resultset that returns some 55 rows which is typically a dynamic query like [Select column_name from table_name where column = condition].
I need to execute this query which is in resultset and insert the value of column_name into another table.
I dont get the way as how to make it. Kindly suggest me as how can I execute it.
View 1 Replies
Sep 30, 2010
Is there a way to row two and three of the result set be returned so that the
following query:
[Code]....
View 10 Replies
Nov 10, 2010
I have the following query, the relationship is mutiple pictures per dog and multiple dogs per registered User. the query below will return dogs that belong to users that have not expired. the problem is that some users have many dogs and other users only have one dog listed, the query below will return a record for every dog. What I would like to do is return a random dog per user and only one dog per user each time the query executes. therefore if I have 10 users and 50 dogs I would like my quesry to only return 10 dogs one beloinging to each user, and the next time the quesry executes it would be nice if it once again return 10 dogs but a different 10 dogs 1/per user where it was able..
[Code]....
View 10 Replies
Oct 11, 2010
Anyone know how to do this? I was thinking about making a sproc with something like
select * from users where @group not in member_of
select * from users where @group in member_of
Since I'm dead tired, that's not supposed to be a real query...just an approximation ;)
View 4 Replies
Feb 23, 2011
I have been trying to get this sproc to return all users if null is passed to it from @UserName and a single users if a username is passed to @Username.Can anyone see where I'm going wrong?
[Code]....
View 5 Replies
Dec 2, 2010
In my project, I've been told to create a sproc to get some data. Fine. No problem. However, as we're moving away from a solution created by an external consultant I've had to spend a couple of days trying to figure out how the tables are linked. Sure... However, the big problem is that since this consultant is not supposed to know about this move just yet, I've been told to put my sproc in our production database (same server), and I've been unable to find any good info on this on google S
View 8 Replies
Sep 23, 2010
[Code]....
I want to keep the old password if the user leaves the password field blank, otherwise store the new password.
I have also tried "IS NOT NULL" instead of "= NULL", but without success. I've tried to send in an empty string and a DBNull value but it never keeps the old password.
View 2 Replies
Jan 7, 2011
I have a table with about 300 OrgID's that I would like to pass into this sproc as the @Org_ID, so I don't have to do them one at a time. How would I do that?
insert into tblRelClients (client_ID, clientRel_ID)
select c1.client_ID, c2.client_ID from tblclients c1 inner join tblclients c2 on c2.OrgID = c1.OrgID
where c1.OrgID = @Org_ID
View 6 Replies
Jul 22, 2010
I'm trying to call a linked server, SS2000 that has NText field and instert that data into an nvarchar(120) field on SS2008.
If I execute the SPROC from SS2008 Management Studio, it works fine. If I try to call the SPROC from my ASP.NET 3.5 web application, I don't get any errors, but the data doesn't get updated.
I'm using the following SPROC:
CREATE PROCEDURE [dbo].[usp_UpdateMilestoneDescription]
@UID int
AS
BEGIN
[Code]....
View 7 Replies
Feb 3, 2011
i have a stored procedure with multiple parameters. and several statement which utilities a specific set of queries. therefore, every time its not necessary data will be passed through the parameters, so how can i make "providing data to parameter" optional
My stored procedure:
[Code]....
View 2 Replies
Aug 4, 2010
I'm building a dynamic form using XML and XSLT. Anyway I'm using a custom asp.net control for CKEditor, it's an HTML editor.
When I try to add the controls from the XSLT using Page.ParseControl(<the-string-from-the-xslt-here>), I get a warning saying:
Unknown server tag 'FCKeditor.CKEditor'
And of course, if I remove the control from the XSLT everything is working fine and all the regular asp.net controls like TextBox etc get rendered to the string just fine. Does anyone know what I can do about it?
View 2 Replies
Oct 1, 2010
I run a asp.net 4.0 website. (I did the porting from version 3.5 to 4.0)I receive the following error :ASP.NET AJAX client-side framework failed to loadn a page where I set scriptmanager EnableCdn="true" and there is a microsoft ajax extension Timer on the page.
[Code]....
I receive the error only on the production server.
View 4 Replies
Mar 7, 2012
as per my flow on every click i have a postbackĀ without which i cannot store data to client or server.i have 2 ways of data storing one is client side in javascript variables in form of array(which can be lost on postback) the data to be stored are of differnt types some are numeric , some single characters some sepearted with comma other way is on each post back save the data in a session varibale on server & then access currently i have second way considering both the ways and in accrodance with the current flow which is best for maintenance & access speed reasking as i am notyet cleared abt the things.
View 1 Replies
Nov 15, 2010
I am currently writing a C# web service which has several methods, one of which has to receive HTTP POST requests. The first thing i have done is alter the web.config file in the web service project as below.
[code]....
But when i run this i get "The remote server returned an error: (500) Internal Server Error". If i remove the parameter, by removing the stringbuilder and byte code, as well as having no parameter in the web service, it works. So it is obviously a problem with the parameters. I actually want to send more data, and was using a string[] parameter in the web service, but this also failed.
View 1 Replies
Jul 22, 2010
I have developed simple user registeration application form in that after press submit button i am sending mail to user for welcome template as well as i am also get on mail for user details like name email id, and ip address.my problem is the user can receive the mail form my site but i am receive the any user details mail it doesnot shows any exception what is the problem i donno please
View 4 Replies
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
Oct 30, 2010
I need to know how to display the result of a select query in a datagrid or GridView with VB.NET?
Consider SELECT * FROM some_table. I don't know what columns the table has. Is there a way to just output the result to a table, with a dataset for example?
View 3 Replies
Feb 26, 2011
I have a query which returns multiple columns from the database using LINQ
var donors = from d2 in db.Donors
where d2.Status == "Pending"
select new { donorID = d2.donorID, bloodGroup = d2.bloodGroup, contactNo = d2.contactMobile, status = d2.Status };
now I want to display the results in different Labels accessing one column value from donors resultset.
ex:
Label1.Text = donorID;
Label2.Text = bloodGroup; ...and so on
View 2 Replies
Oct 5, 2010
Can we use different resultset in our Report. Like if we have written two select statement in our SP, how can we use the different result set to bind them in our Report.
View 3 Replies
May 17, 2010
I have a procedure that im going to be calling on my page load, i will pass an id to it and it will return up to 6 records. I need to set a session for each record returned.
Can i do that within my page_load event to pass the value, and set the sessions?
If no results are returned, then that session will be 0. So in other words, regardless there will always be 6 sessions that need to be set, either with the results returned or with 0.
View 22 Replies
Apr 18, 2010
First off, suggest better ways if you want rather than patch up this code. I am just starting this project and it is first time I have tried to code a web site so anything you suggest is very much welcomed. I have spent the last 2 and 1/2 days trying to find workable answers to this but none I have found and tried seem to fit. If needed I can email screens shots or code. I am trying to construct a website that will have the same main theme throughout as far as the header, navbars sitemap, and footer go. Naturally the content will vary from page to page. I want to use a single master page and css stylesheet for this main theme and I will change the content format as needed per page because each page may vary somewhat.
However, about 15 of the pages will all use the same format for their content and this format will differ from the rest of the site but the format of the main theme will stay the same. So I am trying to create a nested master page to use to format the just the content area for all these pages while retaining the main theme for the header, etc.. I believe I should use a separate css file with the nested master page to handle the formatting of the content areas for these 15 pages. I have code that looks like it works when viewed in web developer but design view but does not work when viewd through a browser (IE, Chrome, Firefox). So far I have the following done in web developer.
If it helps the code and screen shots follow. Master Page called "Parent.master". For all theme throughout site Nested Master Page called "Lab.master". For the 15 like pages Primary stylesheet file for main theme called "StylesheetNew.css" For site theme Secondary stylesheet file to syle the 15 like formatted pages. It is called Labmaster.css Labs.apsx file to use as first of the 15 like pages.
Finally screens shots from web developer and browser. Sorry try as I might I could not capture screenshots and put them into this post. The problem is that web developer shows all the area (many lines high) with gray background and with the XXX text that I want to allocate for content in the 15 pages. Yet all the browser show is one line of text o a white background followed by the footer. It looks like the LabStyleSheet works in Web Developer but not in a browser.
Parent.master
<%@ Master Language="VB" CodeFile="Parent.master.vb" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]">
<html xmlns="[URL]">
<head id="ParentHeader" runat="server">
<title>HX5</title>
<asp:ContentPlaceHolder runat="server" id="headerPlaceHolder" />
<link href="~/StyleSheetNew.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div id="wrapper" >
<div id="Header" >
<table class="hdrtbl1" >
<tr>
<td id="hdrtd1" style="width:175px; height:100px;" >
<img id="logo" alt="Logo" src="../Images/logo.png" style="width: 136px; height: 87px" />
</td>
</tr>
</table >
<table class="hdrtbl2" >
<tr><td id="hdrtbl2td1"><b> Providing Professional Technical, Manangement and Business Solution</b></td></tr>
<tr><td id="hdrtbl2td2"> <b> Services since 2004 </b></td></tr>
<tr> <td id="hdrtbl2td3" align="center" ><img id="rdln" alt="RedLine" style=" height:3px;" src="../Images/RedLine.png" /></td></tr>
<tr><td id="hdrtbl2td4" > <b>Committed to Excellence In All We Do</b></td></tr>
</table>
</div>
<div id="navbardiv">
<ul id="topnav">
<li><a href="../pages/about.aspx" >About Us <img style=" border: none; " src="../Images/arrow-down.gif" /></a>
<!--Subnav Starts Here-->
<span>
<a style="font-weight:lighter; " href="#" >Who We Are </a> |
<a href="#">Locations</a> |
<a href="#">Business Classifications</a> |
<a href="#">Contact Us</a> |
</span>
</li>
<!--Subnav Ends Here-->
<li><a href="../pages/services.aspx">Services <img alt="arrow" style="border: none; " src="../Images/arrow-down.gif" /></a>
<!--Subnav Starts Here-->
<span>
<a style="font-weight:lighter; " href="#" >Capabilities</a> |
</span>
<!--Subnav Ends Here-->
</li>
<li><a href="#">Customers <img style=" border: none; " src="../Images/arrow-down.gif" /></a>
<span>
<a style="font-weight:lighter; " href="#" >Subnav Link</a> |
<a href="#">Customer Locations</a> |
<a href="../pages/labs.aspx">Labs</a> |
</span>
</li>
<li><a href="#">Careers <img style=" border: none; " src="../Images/arrow-down.gif" /></a>
<!--Subnav Starts Here-->
<span>
<a style="font-weight:lighter; " href="#" >Joining the HX5 Team</a> |
<a href="#">Current Opportunities</a> |
</span>
</li>
</ul>
</div>
<div id="subnavbar" >
<!-- <asp:SiteMapPath ID="SiteMapPath" runat="server">
</asp:SiteMapPath> -->
</div>
<div id="topContent" style="border-bottom:solid 1px #191970;">
<table>
<tr><td style="height:30px; width:900px;" >
<asp:ContentPlaceHolder id="TopPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</div>
<!-- <div id="mainContent"> -->
<asp:ContentPlaceHolder id="MainPlaceHolder" runat="server" />
<!-- </div> -->
<!-- <div id="lowerContent"> -->
<asp:ContentPlaceHolder id="LowerPlaceHolder" runat="server">
</asp:ContentPlaceHolder>
<!-- </div> -->
<div id="footerContent" style=" height:50px; width:900px; text-align: right; background-color: #ccc; ">
<span style=" font-family: Arial, Helvetica, sans-serif; font-size: xx-small; font-weight: bold; color: #000080; margin: 30px 20px 0px 0px;"> Copyright 2010 HX5, LLC All rights reserved</span></div>
</div>
</form>
</body>
</html>
View 4 Replies
Oct 21, 2010
Can any one please guide, how to bring this output.Below one is Sample Data
[Code]....
View 13 Replies