.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

Show only 1st 5 Rows

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :Sql Server

I want be able to show only the 1st 5 rows of a report. I've tried the Top N operator, but when there is a tie for the 'Nth' value, then there can be greater than 5 rows. I want only the 1st 5 rows regardless of a tie.

Note: I'm using parameters in the report, so putting ROWCOUNT in the DataSet Query is not an option because it depends on which parameters are selected.

View Complete Post

More Related Resource Links

Expand rows in a data grid to show details in the same page

<asp:templatecolumn headertext="Purchase Order"> <headerstyle horizontalalign="center"></headerstyle> <itemstyle horizontalalign="center"></itemstyle> <itemtemplate> <%# DataBinder.Eval(Container.DataItem, "PurchaseOrder") %> </itemtemplate> </asp:templatecolumn> <asp:templatecolumn headertext="Order"> <headerstyle horizontalalign="center"></headerstyle> <itemstyle horizontalalign="center"></itemstyle> <itemtemplate> <a href="OrderDetail.aspx?Order=<%# DataBinder.Eval(Container.DataItem, "OrderNumber")%>"> <%# DataBinder.Eval(Container.DataItem, "OrderNumber") %> </a> </itemtemplate> </asp:templatecolumn> <asp:templatecolumn headertext="Ack Date"> <headerstyle horizontalalign="center"></headerstyle> <itemstyle horizontalalign="center"></itemstyle> <itemtemplate> <%# DataBinder.Eval(Container.DataItem, "AcknowledgeDate") %> </itemtemplate> </asp:templ

Report Builder 2.0: duplicate rows do not show on reports

Hello,Created a report using a report model.the problem is that duplicate rows do not show on the report.Why?And also how can this be fixed?the report shows product ids, that may or may not have serial numbersticket numbers can have mulitple products associated with them and they may or may not have serial numbersthe report data row is as follows:example:order number, ticket number, product id, manufacturer id, serial number123                  456               dsl_router 12  cisco123                  456               dsl_router 12  ciscothe above data shows as one row on the report, thus, showing it to be one product, but really there are 2 products and there should be 2 rows.is this a bug?how can this be fixed?Thanks.

Want to show all rows from one table but only those relating to a single week in the other

This must be a simple one and I am just having a block
I have two tables, Personnel and working details.
I want to show all staff working in a single building but only the working details for a specific week
I have added a join which should list all staff but won't because of the date filter in the working detail table it returns only an exact match, I have added ' or is null' for the date filters but just returns all staff from all buildings
SELECT        [8977].cTblPersonnel.Firstn, [8977].cTblPersonnel.Surname, [8977].cTblWagesFcst.StartDate
FROM            [8977].cTblWagesFcst RIGHT OUTER JOIN
                         [8977].cTblPersonnel ON [8977].cTblWagesFcst.PersonnelID = [8977].cTblPersonnel.PersonnelID
WHERE        ([8977].cTblPersonnel.UnitID =544) 

Drillthrough to show only unique rows

Because of the granularity level of the fact table when we drillthrough to the detail to produce a list of customers we get many duplicates, is there a way of configuring drillthrough to only show unique rows?

SQL Server Linked Server -IBMDASQL SQL select statement does not show rows


Exec ('SELECT * FROM filename') at TST_IBMDASQL

The above SQL statement using Linked Server IBMDASQL, does not show rows it only show the following message:
(1 row(s) affected)

And then if I run the statement, Exec ('SELECT * FROM filename') at TST_IBMDASQL, twice quickly i get the above message then on the second
run i get the message:

OLE DB provider "IBMDASQL" for linked server "TST_IBMDASQL" returned message "SQL0519: Prepared statement S000001 in use.
Cause . . . . . : The application program has attempted to prepare statement S000001. This statement is the SELECT statement for cursor C000001 that is currently open. Recovery . . . : Change the statement name in the PREPARE statement or correct the logic of the application program so that it closes cursor C000001 before attempting the PREPARE statement again.".
Msg 7215, Level 17, State 1, Line 1
Could not execute statement on remote server 'TST_IBMDASQL'.

Its like the whole statement is running on the remote and not returning anything other than the message "(1 row(s) affected)"

This has been working great for years until I formatted the computed and reinstalled everything. Its also working fine on the laptop and at work
and i've compared all settings - all looks ok.

There mus

MDX simple query doesnt show the years in the rows but shows (all) with value




this mdx script should return asset value for the individual years but instead it return one line with a value.

When i use the browser in ssas and select the year in rows and measure, it gives the result back as expected ie. years in the rows and values.

Can you help me out please im stuck here:




      [Measures].[Appraisal Forecasted Value] ON COLUMNS,

     [Asset Value Date].[Year] ON ROWS

FROM [CMSX_DWH_OLAP_AssetExposure]

// Result:


// Appraisal Forecasted Value

//All 1,931,290,000  I miss the Years on rows?



// This is from the browser which is correct because the year is added

Year Appraisal Forecasted Value









Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:

Highlighting Rows with TextBox OnFocus

In another article I explained that how you can make the rows of the GridView control clickable and highlight them when they are clicked. In this article I will explain that how you can highlight the GridView rows when you focus on the TextBox which is contained inside the GridView control.

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

jQuery: Styling DropDownList Alternating Items (Rows)

In the following example, I will show how you can style any asp:dropdownlist very easily.

The example demonstrates how you can change alternating row items background color, using the fadeTo() to add a nice touch in the dropdownlist. You can change alt rows with a couple lines.

MS SQL Server: Search All Tables, Columns & Rows For Data or Keyword Query

If you need to search your entire database for specific data, this query will come in handy.

So when a client needs a custom report or some sort of custom development using Great Plains, most of the time I will have to track down the data in the system by running this query and find the table(s) it is in.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Using jQuery to Filter Table Rows

The project is using the .net GridView control, so I had limited control over the output HTML code. Still, I think this code can work for most tables. One thing to notice: you should use the class "filterable" on your table or on one of its parents for the code to work.
First, we need a text box:

Insert Rows with a GridView

In ASP.NET version 1.x, I used the footer on the DataGrid control to insert new rows by placing a series of TextBox, DropDownLists, CheckBoxes etc. controls on it and then handling a save button. This also works with the GridView in version 2.0 but with one major exception: if your data source is empty, the GridView will hide your footer (and header) and only display the EmptyDataText.

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

RadioButton Groups, Table Rows And NamingContainers in asp.net

The RadioButtonList. Very handy for inviting users to select just one item from a list although because of the screen real estate it takes up, used less and less in favour of the DropDownList. In plain HTML, the browser knows to enforce the unique selected value amongst a list of radio buttons because they all have the same value for their name attributes.
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