If e.DataCol.Name = "班别" Then Select Case e.DataRow("班别") Case "A" e.DataRow("语文_1")=Rand.Next(68,78) e.DataRow("数学_1")=Rand.Next(68,78) Case "B" e.DataRow("语文_1")=Rand.Next(68,78) e.DataRow("数学_1")=Rand.Next(68,78) Case "C" e.DataRow("语文_1")=Rand.Next(68,78) e.DataRow("数学_1")=Rand.Next(68,78)