vb如何在窗体循环显示数据库中数据?
想在VB窗体中显示数百条数据库中的数据,每行显示10条数据,每条3列,每页20条,超过一页显示的条数就分页显示,用什么方法可以实现这样效果呢?
越详细越好.谢谢.
[解决办法]
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click Dim MyPos As Integer = Convert.ToInt16(Me.textBox2.Text) Dim MyCount As Integer = Convert.ToInt16(Me.textBox1.Text) Dim MyConnection As New System.Data.SqlClient.SqlConnection() MyConnection.ConnectionString = _ "Data Source =.\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True" MyConnection.Open() Dim MyCommand As New System.Data.SqlClient.SqlCommand( _ "Select * From Customers ORDER BY CustomerID", MyConnection) Dim MySet As New DataSet() Dim MyAdapter As New System.Data.SqlClient.SqlDataAdapter(MyCommand) MyAdapter.Fill(MySet, MyPos - 1, MyCount, "Customers") Me.dataGridView1.DataSource = MySet.Tables("Customers") End Sub
[解决办法]
每行显示10条数据,每条3列.
没看懂
[解决办法]
每行显示10条数据,楼主再解释下,我笨。
每页20条又是什么?