非常感谢那些回答我问题的人。我赶时间,所以我现在需要解决这个问题。
这是另一个错误
代码如下:
Private Sub RefreshData()
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT txtID as [ID], " & _
"txtLName as [LastName], txtFName as [FirstName], txtMI as [MI] " & _
"txtGender as [Gender], txtDept as [Department], txtNo as [ContactNo]" & _
"txtAddress as [Address], txtEAdd as [EmailAddress], txtYear as [YearEmployed]", cnn)
Dim dt As New DataTable
da.Fill(dt)
Me.dgvProfessorList.DataSource = dt
cnn.Close()
End Sub
答案 0 :(得分:1)
您的查询可能有误,您错过了逗号(,)来分隔列。它应该是
Dim da As New OleDb.OleDbDataAdapter("SELECT [ID],[LastName],[FirstName],[MI],[Gender],[Department],[ContactNo],[Address],[EmailAddress],[YearEmployed] From ProfessorListTable", cnn)