VS 2008 - Group In ListView (SQL Query)

Apr 14, 2010

I have a listview in which the View is set to Details. I have a module with a Sub that accepts a Listview and a sql query as arguments:

Public Sub PopulateListView(ByVal lvw As ListView, ByVal filtersql As String)
Dim li As New ListViewItem
Dim lvwColumn As ColumnHeader
Dim counter As Integer
[Code] .....

This is how I call the sub:
PopulateListView(lvwTranHistory, "SELECT AccountID,TransactionDate,TransactionAmt FROM [Transactions] WHERE GameSheetID = " & CurGameSheetID & ";")
I tried some stuff there to group by the accountid but it ain't working. How to get the grouping to work.

View 1 Replies


ADVERTISEMENT

Remove All Items In A Listview Group And The Group Name?

Sep 25, 2011

I want to remove a group (include all items in this group) in ListView, but unsuccessful, the code is below, why?

ListView1.Groups("GroupName").Items.Clear()
ListView1.Groups.Remove(ListView1.Groups("GroupName"))

View 4 Replies

Group By Clause In Sql Query?

Aug 26, 2009

I have a table DailyTransaction in MsAccess as under: DTDate, DTTime, CustId, Description, Quantity, Price, Amount, AccountNumber, Name I want to extend following query with a Group By clause:I require to display all records in a Listview Group By CustId.Then I require to display all records in a Listview Group By AccountName.e how I can extend following query with Group By clause to achieve the required results

View 4 Replies

Get A Linq To Sql Group By Query Into The Asp.net Mvc View?

Dec 23, 2009

I have the following query that groups parking spaces by their garage, but I can't figure out how to iterate the data in the view.

Public Function FindAllSpaces() Implements ISpaceRepository.FindAllSpaces
Dim query = _
From s In db.spaces _
Order By s.name Ascending _

[code]....

The controller is taking the query object as is and putting it into the viewdata.model and as stated the view is not currently strongly typed as I haven't been able to figure out how to do this. I have run the query successfully in linqpad.

View 2 Replies

Sql Server Query To Group Records?

May 9, 2011

i would like to select from the following table:

PostTable

feed dateinserted count
box1 2011-05-28 11:00 1000[code].....

the total number of records for the previous day where the feed is, 1, 3 and 5 i.e.the feeds I need to retrieve totals for will just be selected based on what I need for instance it could be box4 and box 5...not specifically odd and even...I hope this makes it more clearer..what I have for all records:

select sum(count) as [total] from PostTable where Cast(dateinserted as DATE) =
CAST(getdate()-1 as DATE)

View 3 Replies

How To Group Distinct Columns In A Linq Query

Nov 4, 2010

The following data is created by joining two sql tables together:I would like to group together distinct rows of DateStamp/UserName/ StudentName/ InstructorName/TableName/PrimaryKey (I'll call this 'group records') and then group under these ColumnName/PreviousValue/NewValue (I'll call this 'subgroup records')The end result would be that I could iterate through the 'group records' - there would be 5. In each 'group record', I could then iterate through the 'subgroup records'. The 5 groups would contain 3, 2, 5, 2 and 1 subgroup records respectively.What would be the syntax to create a query to do this? Ideally this would be in a vb.net linq syntax.

View 1 Replies

Order By And Group By In A Linq To Objects Query?

Sep 28, 2010

How do I order by and group by in a Linq query?I tried..Dim iPerson = From lqPersons In objPersons Where Len(lqPersons.Person) > 0 Group lqPersons By key = lqPersons.Name Into Group Order By Group descending Select Group, key

For Each i In iPerson
tmp = tmp & vbNewLine & i.key & ", " & i.Group.Count
Next

[code].....

View 5 Replies

Expand And Collapse Listview Group?

Dec 13, 2009

I add expanders and collpase in Listview groupadil

View 2 Replies

Make ListView Group Tasks?

Apr 27, 2010

I have a problem with ListView Group Tasks in Visual Basic.net. I've created a derived class from ListView wich have collapsible groups, and other features not included in common listviews. I use the LVN_LINKCLICK to catch the Task clic event, but when

View 1 Replies

Move User To Group In Listview?

Dec 5, 2009

i have a list view with items that a user adds and what i want to do is run a query from my database that checks if the items in the list view are active and if they are move them to a group on the list

EG
Test = active
NoTest = Inactive
Group Online

[Code].....

i have 2 groups Online and offline i want to check if the user is online and if so move them to the online group

i have the query and that to check it i just dont know how to move the users to the correct group

View 1 Replies

LDAP Query To Return All Users In A Specific Group?

Feb 24, 2010

how i can get a list of users who are members of a group in Active Directory. A vb.net example would be great. I can list all users in AD, but cannot get just the users in a group.

Also do anybody know of a really easy tutorial on LDAP queries with vb.net examples.

View 1 Replies

LINQ Query With Sum And Group By Is Adding Decimal Precision

Aug 24, 2009

I am trying to do a simple summary of table data using a LINQ query.a regular SQL Query looks like:[code]This query works fine and returns the correct results.[code]This LINQ query returns the incorrect results some of the time. Off by .01 in most cases.The "value" column is of type Numeric (12,2) in the database.Now when I show the values from the Sum in a msgbox I get extra precision and thus incorrect results as my end result because of rounding.For example I get 835.18 + 54.62 = 889.80960 from the above LINQ query.I am running Visual Studio 2008 9.0.30729.1 SP on Vista 64Bit with .NET 3.5 SP1.

View 3 Replies

Optimize Linq To SQL Query, Group By Multiple Fields

Jul 26, 2010

My LINQ query contains the following Group By statement:

Group p By Key = New With { _
.Latitude = p.Address.GeoLocations.FirstOrDefault(Function(g) New String() {"ADDRESS", "POINT"}.Contains(g.Granularity)).Latitude, _
.Longitude = p.Address.GeoLocations.FirstOrDefault(Function(g) New String() {"ADDRESS", "POINT"}.Contains(g.Granularity)).Longitude}

The query works, but here is the SQL that the clause above produces

SELECT [t6].[Latitude]
FROM (
SELECT TOP (1) [t5].[Latitude]

[Code]....

but this produced an error: "A group by expression can only contain non-constant scalars that are comparable by the server."

View 1 Replies

Drop Items Into Specific Group In A Listview?

Jul 12, 2010

I'm trying to drag an item between two Groups in the same ListView called 'listTasks'.

Private Sub listTasks_ItemDrag(ByVal sender As Object, ByVal e As ItemDragEventArgs) Handles listTasks.ItemDrag
listTasks.DoDragDrop(listTasks.SelectedItems, DragDropEffects.Move)
End Sub
Private Sub listTasks_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs) Handles listTasks.DragEnter

[Code]...

With listTasks.PointToClient(New Point(e.X, e.Y)) you could use listTasks.GetItemAt(p.X, p.Y) to get the ListView item you're over. Is there something like this for Groups? Or perhaps a better way to determine what group is the target of a drag-drop?

View 1 Replies

Group Name Font In Listview Shown As Bold?

May 18, 2011

I want to show the group name font in listview as bold, can i do that?

View 1 Replies

Sql - Group By Having And Count As LINQ Query With Multiply Nested Tables?

Feb 28, 2012

I have the following SQL query to return all Customers who have no OrderLines with no Parts assigned - i.e. I only want the customers within which every order line of every order has no parts assigned - (in the actual problem I am dealing with a different domain but have translated to customers/orders to illustrate the problem)

SELECT c.Customer_PK
FROM Customers c
INNER JOIN Orders o[code].....

This works but generates less than optimal SQL - it is doing a subquery for Count on each row of the customers query rather than using Group By and Having. I tried making the LINQ Group By syntax work but it kept putting the filter as a WHERE not a HAVING clause.Edit in response to Answers below: I am accepting JamieSee's answer as it addresses the stated problem, even though it does not produce the GROUP BY HAVING query I originally had.I am a VB developer so I have had a crack translating your code to VB, this is the closest I got to but it does not quite produce the desired output:

Dim qry = From c In context.Customers
Group Join o In context.Orders On c.Customer_PK Equals o.Customer_FK
Into joinedOrders = Group[cod].....

The problem I had is that I have to push "jl" into the Group By "Key" so I can reference it from the Where clause, otherwise the compiler cannot see that variable or any of the other variables appearing before the Group By clause.With the filter as specified I get all customers where at least one order has lines with no parts rather than only customers with no parts in any order.

View 3 Replies

VS 2010 Loop Through The Results Of Capture Group Regex Query?

Apr 29, 2012

I'm trying to find a way where i can make it loop through the results of my capture group regex query.

For instance if i have this:

VB.NET
Dim matches = Regex.Matches("<h1><span>test</span></h1>", "(?<=<h1>(<span>)?)(?<data>.+)(?=(</span>)?</h1>)")For Each item In matches.OfType(Of Match)()Console.WriteLine(item.Value)Next

And i'm trying to get the contents of <data>, how do i do it without it printing out the junk before it and after it?

quantifier isn't working, its supposed to make the <span> tag optional in the query, but it isn't.

View 2 Replies

Change The Text Color Of Listview's Group Header?

Jun 21, 2010

I want to change the color of the group header text in listview which separates all the items into various groups, there is no such option to do that directly because no such property exists.

[Code]...

View 3 Replies

Linq To Sql, Aggregate Columns ,group By Date Into Listview?

Aug 3, 2011

also i have a table called Orders with several columns, they contain information about the order and store the ID of the Customer they belong to.Question is: how can i query that table with (preferably) linq (the datacontext is from LinqToSql) to return the following dataI want to search for any entry with the matching CustomerID which took place, group them by Year, Sum the Totals respectively and add them to the listview?I now i could use lamda expressions and aggregate, its just not clear how (option infer on,db is a datacontext object,CustomerID is an int32 variable):

Dim Orders = (From order In db.Orders Where order.CustomerID = CustomerID).GroupBy(Function(p) p.Date.Year).GetEnumerator
I reckon i'd have to create an anonymous type like the following:

[code].....

View 1 Replies

Calculate Running Total In Listview Group Extract From Database?

Dec 30, 2011

I'm developing Asset Management System, it will compute for straight line depreciation, my problem is how to calculate running total on each group that I've extracted from my database.Here's a snippet for my extraction of data

Private Sub cboAType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboAType.SelectedIndexChanged
ListView1.Items.Clear()
If Not cboAType.Text = "-" Then

[code]....

View 4 Replies

Change Text Color Of Listview's Group Header In Program?

Nov 17, 2009

I want to change the color of the group header text in listview which separates all the items into various groups, there is no such option to do that directly because no such property exists.

As far as i can think of it can be achieved via overriding the paint event but i have not done any overriding of paint events on windows controls so far.

View 2 Replies

LINQ Query To Group Data Between Two List Collections, Populating A Nested Object

Oct 26, 2011

I have these objects:[code]Using LINQ I need to take a List(Of MakeInfo) and a List(Of ModelInfo) and aggregate the StockInfo from ModelInfo into the List(Of MakeInfo).So for each MakeInfo I will have a total count of all stock where MakeInfo.Name = ModelInfo.Make, and also a minimum price.I think it's going to be something like this, but I'm having trouble accessing the nested object and not sure if it's going to be possible with a single query.[code]

View 2 Replies

Populate A A Listview Control With Items And Subitems That A User Enters Into A Group Of Textboxes On A Form?

Feb 13, 2009

I am trying to populate a a listview control with items and subitems that a user enters into a group of textboxes on a form. It looks as if some of the code to do this has changed since VB6 and I am confused again. Here is the current code I am using without success:

lvSurgProcedure is the name of my listview control
Private Sub btnAddSurgeProcedure(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddSurgProcedure.Click
Dim lvItem As New ListViewItem

[code].....

View 15 Replies

How To Make Listview Query

Feb 19, 2012

I have a problem with not getting my head around this at all.The problem is i need to:Add a customer to list view (I can do)Add multiple products to that specific customer on a daily basis from another database (which i cant do)Then somehow use listview to generate a list of these customers only showing outstanding amount from previous weeks and current weekly amount. then be able to "Roll forward" a week populating listview again with customers and outstanding amounts.I need to have the ability to input payments from the customers as well

View 7 Replies

Active Directory Query To Listview

Mar 9, 2012

Something weried happening when i try and return 4 AD properties to a listview box, here is my code:

Dim li As ListViewItem
Dim dirEntry As DirectoryEntry = New DirectoryEntry("LDAP://172.16.0.3/OU=Staff,OU=Users,OU=Accounts,OU=Network,DC=X,DC=local")
dirEntry.Username = "x"

[Code]....

View 1 Replies

Search Query Using Combobox And Listview?

Feb 11, 2012

I have a problem with search query im using combobox for searching in my code there's is no error.but nothings happen when i search this is my code:

Public Sub searchdata()
Try
SQLCONNECTIONS.connect()

[code]....

View 3 Replies

Wrong Column After SQL Query In ListView?

Apr 7, 2009

i have a small ListView in my form. The have only 2 Columns (Datum) and (Anzahl). When i fill the ListView the first Column is not filled, only the second Column (Anzahl) is filled with "Datum". How can i get the "Datum" in the Datum-Column?

Here is my code:

Dim selStr1 As String = "SELECT CONVERT(VARCHAR(10),datum,101) AS Datum, COUNT(*) AS Anzahl FROM stat11patienten WHERE datum BETWEEN '" & startdatum & "' AND '" & enddatum & "' GROUP BY CONVERT(VARCHAR(10),datum,101)"
Dim da1 As New SqlDataAdapter(selStr1, conn)
Dim ds1 As New DataSet()

[code]....

View 5 Replies

See If Current User's Group Name Matches A Specified Group Name Using Active Directory Roles And SID's?

May 3, 2011

I'm trying to match up a specific group name and see if it exists for the currently logged in user using Active Directory roles. If the Group Name exists for the Current User, I want that group name to be displayed in a drop down list. Example: If current user is in BIG Group, display BIG in drop down list.Problem: All I am getting is SIDs and I'm not able to get anything to match up to the group name and nothing will show up in the drop down list.I also get the following Error:Error: Object variable or WIth block variable not set.How do I fix this?? here is the code I am using:

Private Sub GetMarketingCompanies()
' code to populate marketing company drop down list based on the current logged in users active directory group that

[code].....

View 3 Replies

Enumerate If An Active Directory Group's Member Is User Or Another Group

Jan 31, 2011

Enumerate if an Active Directory group's member is user or another group

View 1 Replies

Save Listview Data To Mysql Query Browser?

Nov 15, 2011

this is the code for my save button

Dim iCount As Integer
Dim iLoop As Integer
Dim query3 As New MySqlCommand

[Code]....

every time i hit save, there is no error but it does not save on my database.

View 5 Replies







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