找不到用新数据替换以前数据的方法....
我使用一个按钮在 dgv 中查看我的表格。当我单击按钮两次查看我的表格时,它只显示下一个数据和上一个数据
这是我正在使用的代码
Private Sub cmdview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdview.Click
connetionstring = "Integrated Security = SSPI; data source= DELL-PC;Initial catalog=Library System"
connection = New SqlConnection(connetionstring)
sql = "select * from dbo.tblbook"
Try
connection.Open()
adapter = New SqlDataAdapter(sql, connection)
adapter.Fill(ds)
connection.Close()
dtg1.DataSource = ds.Tables(0)
Return
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub