jeudi 29 janvier 2015

System.Reflection.AmbiguousMatchException, doesn't display all data on ListView

I keep getting the error



A first chance exception of type 'System.Reflection.AmbiguousMatchException' occurred in Microsoft.VisualBasic.dll



When I want to display a ListView on load of a form. For example I have 2 rows of data in my database, but when I try to list it, it only shows the first row. I'm guessing it won't loop and populate the ListView? Here is my code:



Private Sub AddGrades_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim ClassIntl = TextBox1.Text
DBConn()
SQLSTR = "SELECT * FROM '" & ClassIntl & "'"
readDB()
ListView1.GridLines = True
ListView1.FullRowSelect = True
ListView1.View = View.Details
ListView1.MultiSelect = False
ListView1.Columns.Add("StudentID", 80)
ListView1.Columns.Add("First Name", 80)
ListView1.Columns.Add("Last Name", 80)
ListView1.Columns.Add("Q1", 80)
ListView1.Columns.Add("Q2", 80)
ListView1.Columns.Add("Q3", 80)
ListView1.Columns.Add("Q4", 80)
ListView1.Columns.Add("Q5", 80)
ListView1.Columns.Add("Q6", 80)
ListView1.Columns.Add("S1", 80)
ListView1.Columns.Add("S2", 80)
ListView1.Columns.Add("S3", 80)
ListView1.Columns.Add("A1", 80)
ListView1.Columns.Add("A2", 80)
ListView1.Columns.Add("A3", 80)
ListView1.Columns.Add("PrelimExam", 80)
ListView1.Columns.Add("MidtermExam", 80)
ListView1.Columns.Add("FinalExam", 80)
ListView1.Columns.Add("PrelimTotal", 80)
ListView1.Columns.Add("MidtermTotal", 80)
ListView1.Columns.Add("FinalTotal", 80)
While (SQLDR.Read())
With ListView1.Items.Add(SQLDR("StudentID"))
.subitems.add(SQLDR("FirstName"))
.subitems.add(SQLDR("LastName"))
.subitems.add(SQLDR("Q1"))
.subitems.add(SQLDR("Q2"))
.subitems.add(SQLDR("Q3"))
.subitems.add(SQLDR("Q4"))
.subitems.add(SQLDR("Q5"))
.subitems.add(SQLDR("Q6"))
.subitems.add(SQLDR("S1"))
.subitems.add(SQLDR("S2"))
.subitems.add(SQLDR("S3"))
.subitems.add(SQLDR("A1"))
.subitems.add(SQLDR("A2"))
.subitems.add(SQLDR("A3"))
.subitems.add(SQLDR("PrelimExam"))
.subitems.add(SQLDR("MidtermExam"))
.subitems.add(SQLDR("FinalExam"))
.subitems.add(SQLDR("PrelimTotal"))
.subitems.add(SQLDR("MidtermTotal"))
.subitems.add(SQLDR("FinalTotal"))
End With
End While
End Sub


Any suggestions would be great. Thanks in advance!


Aucun commentaire:

Enregistrer un commentaire