改成,参考红色代码修改
If dr IsNot Nothing Then
e.DataRow("姓名") = dr("姓名")
e.DataRow("班级") = dr("班级")
If d1 Is Nothing Then
e.DataRow("大一成绩") = Nothing
Else
e.DataRow("大一成绩") = d1("总分")
End If
If d2 Is Nothing Then
e.DataRow("大二成绩") = Nothing
Else
e.DataRow("大二成绩") = d2("总分")
End If
e.DataRow("大三成绩") = d3("总分")
e.DataRow("大四成绩") = d4("总分")
End If