Datagrid视图无法正确显示

时间:2016-06-10 11:47:51

标签: vb.net datagrid

任何想法会导致什么?enter image description here

我有一个datagridview,结果已经清除然后加载其他结果。这就是正在发生的事情。它在VB中。

继承我的代码:

 Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        ds.Clear()
        ds.Tables.Clear()
        resultsTable.DataSource = ds

        Dim str As String = "Data Source=" & My.Settings.dbServer & ";uid=" & My.Settings.dbUsername & ";pwd=" & My.Settings.dbPassword & ";database=" & My.Settings.dbDatabase
        Dim con As New SqlConnection(str)
        Dim com As String = "SELECT * 

             FROM Scripts
               where completed = 2
             group by   PrescriptionID"
        Dim Adpt As New SqlDataAdapter(com, con)

        Adpt.Fill(ds, "Emp")

        resultsTable.DataSource = ds.Tables(0)


    End Sub

由于

1 个答案:

答案 0 :(得分:0)

尝试使用     resultsTable.Rows.Clear() 在第三行之后