Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have this code
VB
RptSurname.Show()
       Dim qry As String = "SELECT Count([LastName]) AS surname,lastname  FROM Voter group by (lastname)"
       Dim da As New OleDbDataAdapter(qry, My.Settings.trialConnectionString)
       Dim ds As New trialDataSet
       da.Fill(ds, "voter")
       Dim rpt As New RptSurane
       rpt.SetDataSource(ds)
       RptSurname.CrystalReportViewer1.ReportSource = rpt



like
count of lastname   lastname

      10             Kumbhar

      21             Patil   



i want show the count and lastname in report is possible
please help me

thanks in advance
.
Posted
Updated 19-Sep-13 3:19am
v2

1 solution

When you do groupings in SQL, the order of the columns is important. You want the count last even if your report is going to display it fist.

Try this:
SELECT lastname, Count(*) AS surname FROM Voter GROUP BY lastname
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900