.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

Is there a way to combine multiple rows

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :Sql Server

Hi All,

I was wondering if there was a way you combine multiple common rows and have one column as a counter in a query, to turn this:

Usage Description Item Name Item Qty Item Length Item Colour
Wall Girts 60TH075

View Complete Post

More Related Resource Links

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

>>>How to update multiple rows of gidview by one click



I want to add multiple rows of a gridview if the data for multiple fields are same.

Idea for this is that a user may search a record with some parameter e.g. Sector, plot.

For example 15 records being displayed in gridview.

There should be checkbox before every row and if user wants to update Plot and Flat No that is same for 10 rows out of 15 so he will check the rows and update.

For this a dialog box should appear asking for the parameter i.e. Plot and Flat or something else next time may be it will be City or country. Moreover, there is already an Edit button to update records, when user click it another page open for the record to be updated and whatever he wants to update, it updates.

Hope everone understand the scenario.

I don't want to disturb the already provided Edit functionality and want to provide same record to be updated.

Any idea in this regard would be appreciated.

Web Services: Increase Your App's Reach Using WSDL to Combine Multiple Web Services


The very tools that have helped drive the growing adoption of Web services, and the enabling abstractions that they provide, can often prevent developers from peeking behind the curtains at the XML standards that make up the Web services stack. This article will offer a solution that enables type sharing between proxies created for complementary Web services, while at the same time providing an opportunity to examine the Web Services Description Language (WSDL) and its interaction with the Web services tools you know and love.

Gerrard Lindsay

MSDN Magazine March 2005

How do I combine multiple VB arraylists into one?

 Hi Everyone- I have three arraylists (datasets and subsets) that I need to combine into one arrraylist so I can databind it to a repeater control and then present data to the user.  As far as I know, you can only bind the repeater with one datasource (please correct me if this is wrong) that's why I'm combining these arraylists. Each arraylist has an ID from the database which I can use as a datakey to keep the data aligned.  How do I combine these lists? Thanks for your help!

Searching a NVarChar Column with multiple wildcards returns all rows

I'm building a stored procedure to return a set of records, yes nothing big. The column is an NVarchar column and I'm using a select statement of Select * from Table1 where Column1 Like @Column1 Table is currently one record containing the words:  ***Some Test Word***  Is my test word I've set the value of @Column1 to: Some - no records returned Some% - no records returned %Some% - 1 record returned  % - 1 record returned *% - no records returned %*% - 1 record returned %Not Here% - 1 record returned   Can someone tell me why if I have a leading and trailing wildcard I will get all records returned?  Does it have something to do with the '*' characters in the field because some of my users are using these characters. I've also tried changing the select to: where RTRIM(Column1) Like @Column1 with the same result and where RTRIM(Column1) Like N'%' + @Column1 with the same result   What way should I give a user the way to search for a substring inside of an NVarchar field? Oh, I tried using the Substring function and got the same result. Thanks Mike    

Infopath 2007 Repeating Table - Multiple Value Column Text - Hiding Rows based on Column text values

Infopath 2007 browser based form Full Trust Example: I have a repeating table (FruitChoice) that has multiple columns. Both drop down list point to sharepoint list data sources. Choose your tree ft. drop down list – 6Ft Choose your Department drop down list - 103 This repeating table is conditional on the drop down values. This works great. Trees     Fruit       Cost   Date Ordered    Date Delivery Department 6Ft        Peaches                                                        103 3Ft        Apples                                                          102 3Ft        Peaches         &

WPF Datagrid SelectionChanged event is triggering Multiple times while loading the rows.



When i use DataGridComboBoxColumn in my WPF DataGrid, the DataGrid SelectionChanged event is triggering multiple times based on the number of rows while loading the rows in the WPF DataGrid.

How can i stop this? Because of this I am facing Performance issue.



Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This will help other members to find the solution easily.

DetialsView where each row has multiple detail rows from another table


Hi everyone,

I have a <asp:DetailsView> based on a table that has a details table, like so:

DB1 --> TABLE1 --> Customers: ID, name, street, mail

DB1 --> TABLE2 --> SitesToCustomers:  CustomerID, SiteID

Problem One: I need my details view to show / edit both values from customer table and SitesToCustomers table, How do i do that?

Problem two: The site name (oppesed to its code that is saved at SitesToCustomers) is found on another DataBase in this table:

DB2 --> TABLE1 --> Sites: ID, SiteName

How can make the data source show site names according to their id's from SitesToCustomers table?

all of the code behind is c#.

Any help will be much appreciated,

and please use code examples, i'm pretty new to asp.net / c#.

How to return looped procedure results so that they display as multiple rows of a single output inst


I understand that the below fragment will return a separate 1-row results set for each successful loop (also unnecessarily repeating the column header each time). How can I alter my procedure so that each value returned by the loop is appended underneath the previous value as multiple rows of a single results set? Do I have to store each return value in a temp table or someother storage object? It would be nice to just be able to spit them out row by row as each loop returned. Possible? Easy? Hard? I really appreciate the help I've received here so far.

SELECT (whatever)

OPEN techCursor;
FETCH NEXT FROM techCursor INTO @techNumLoop;
EXECUTE pr_FindExpenses4Tech @techNumLoop, @itemCount OUTPUT
SELECT @itemCount Item_Count

Combine multiple xml elements into one column field based on subheading


I need to pull down data from a third party vendor's SQL view, where one of the columns is xml. I've never worked with xml before; unfortunately our vendor was not willing to change the format to what they were previously providing.

XML Example:

<ResponseDTO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

How to update multiple rows in gridview in one shot?

Hi I am using an SqlDataSource control to bind employee data to the gridview.I am displaying 20 rows per page and each row has a checkbox in the Itemtemplate. I may select(check) randomly 15 rows. I want to update all these selected rows in one shot. Is it possible in gridview? Would somebody explain with a piece of code..?

Combine multiple columns in EF



I'm using VS2010, EF. My goal is to combine multiple columns in my metadata so I can display a complete address in one column from a gridview (list). 

Such as:

The Coffee House
100 Main Street
South Bend, IN 46556

Here's my code; (I also want to add line breaks)

    public partial class ResHistory
    public class ResHistoryMetaData
        [DisplayColumn("Address1", "Address1", false)]
        public partial class Address1
            public override string ToString()
                return Address1.ToString() + " " + Address2.ToString() + " " + City.ToString() + " " + State.ToString() + " " + Zip.ToString();


The error I'm getting:

Error 2 The name 'Address2' does not exist in the current context
Error 3 The name 'City' does not exist in the current context
Error 4 The name 'State' does not exist in the current context
Error 5 The name 'Zip' does not exist in the current context

Help with breaking the string of a row to multiple rows


I need some help with sql, where I have to break the string in each column and assign the corresponding values of the string to all, here is the example

ID Name Value
1 A;B;C 1
2 A;B

Split Grid Cells dynamically into multiple rows : WPF


How can i achive this table structure GUI using available WPF controls dynamically?


Col 1

Col 2

Col 3

Col 4

Row 1


How to edit multiple rows in a grid



I have a gridview on a web form and it is working, but the users find it too slow for data entry with them having to click on the edit and update buttons.  I would like to allow them to edit all the rows and then when the form's overall save button is pressed then I save the changes.  I found this: http://csharpdotnetfreak.blogspot.com/2009/05/edit-multiple-records-gridview-checkbox.html which does something similar, but I don't want to use the check box to indicate which row is being edited.  I've got close based on that code, but one of the controls in the column needs to control how the rest of the columns are displayed and I can't work out how to refer to the other columns and control on the current row from some code that is called by the OnTextChanged associated with a control.

I hope I've managed to state clearly what my problem is, if not let me know and I'll try again.

Thanks for any help 

Insert multiple rows with a single INSERT statement


With SQL Server 2005 Express coming out, I have switched from MySql.  I'm having trouble with a very simple INSERT statement that has previously worked in both MySql and Oracle.  The statement is as follows:

INSERT INTO pantscolor_t (procode,color,pic) VALUES
 ('74251', 'Black', '511black.jpg'),
 ('74251', 'Charcoal', '511charcoal.jpg'),
 ('74251', 'Khaki', '511khaki.jpg'),
 ('74251', 'Navy', '511navy.jpg'),
 ('74251', 'OD Green', '511odgreen.jpg');

However, when I attempt to execute this statement with Management Studio Express I get the following error:

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ','.

Any ideas?

SQL Query Multiple rows Top problem.

This is a simplified example of my problem.
I have a Product table, and a ProductSupplier table.  A Product can have multiple Suppliers; these suppliers are ordered according to a sort order field and each has an associated price for the Product.

I want to run a query to return all my products, along with their first supplier and the cost against this supplier.

Currently the only way I can do this is by performing select statements in the manin select clause to retrieve the supplier information.






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