MySql Count returning 0

newbie_gb

New member
Joined
Aug 18, 2006
Messages
3
Programming Experience
Beginner
I am trying to retrieve the count of records grouped by an ID. It retrieves all the ID's but
returns a 0 in the count?



VB.NET:
Dim MC_Conn As New OleDb.OleDbConnection("...")
Dim fdCom As New OleDb.OleDbCommand("SELECT MEETING_ID, Count(SDC_REGISTRANTS.PK) 
as Regis FROM SDC_REGISTRANTS group by SDC_REGISTRANTS.MEETING_ID", MC_Conn)
fdCom.Connection.Open()
 
Dim CategoryTable As DataTable = New DataTable
Dim CategoryView As DataView
Dim CategoryRow As DataRow
CategoryTable.Columns.Add(New DataColumn("MeetingID", GetType(String)))
 
CategoryTable.Columns.Add(New DataColumn("Registrants", GetType(Integer)))
 
 
Dim fdRead As OleDb.OleDbDataReader = fdCom.ExecuteReader(CommandBehavior.CloseConnection)
 
While fdRead.Read
CategoryRow = CategoryTable.NewRow()
CategoryRow(0) = fdRead("MEETING_ID")
CategoryRow(1) = fdRead("Regis")
 
CategoryTable.Rows.Add(CategoryRow)
End While
CategoryView = New DataView(CategoryTable)
 
MC_Conn.Close()
Return CategoryView
 
Last edited by a moderator:
Back
Top