使用SQL數據庫檢索到記錄集。任何理由你可以看到這不起作用? dataFN是datagridview中的名稱,這是正確的。該消息框顯示51,000左右的記錄,所以SQL命令運行良好。如何從記錄集寫入到datagridview?
在此先感謝
Dim i As Integer = 0
rs.Open("SELECT Elig.FirstName, Elig.LastName, Elig.GroupID, CallLog.EligID, " + _
"CallLog.DateTime, CallLog.AssignTo, CallLog.Status, CallLog.ReasonCode, " + _
"CallLog.ReasonDesc FROM Elig INNER JOIN CallLog ON Elig.EligID = CallLog.EligID " + _
"ORDER BY Elig.FirstName", AdoCon, rs.CursorType, rs.LockType, 0)
MessageBox.Show("you have " + rs.RecordCount.ToString + " rows")
While Not rs.EOF
DataGridView1.Rows(i).Cells("DataFN").Value = rs.Fields("FirstName").Value.ToString
rs.MoveNext()
i += 1
End While
明白了......需要在添加行之前添加一行... DUH DataGridView1.Rows.Add() – Coomanperson