Hello All

we want to print datagrid view's 20 records per page, but it seems LIMIT Command is not working and shows error plz can any one help or suggests alternet.

this is our coding.

 ANPSql = "Select * from Table1 limit 0,20"
            MsgBox(ANPSql)



            Pth = My.Application.Info.DirectoryPath

            ANPConn.ConnectionString = "Provider=Microsoft.ace.oledb.12.0; Data Source=" & Pth & "\db1.mdb; User Id=admin; Password=;"


            ANPDa = New OleDbDataAdapter(ANPSql, ANPConn)

            ANPDs = New DataSet
            ANPDa.Fill(ANPDs, "ANPDatabase")
            ANPDt = ANPDs.Tables("ANPDatabase")

            ANPCmb = New OleDbCommandBuilder(ANPDa)

            ANPDa.InsertCommand = ANPCmb.GetInsertCommand
            ANPDa.UpdateCommand = ANPCmb.GetUpdateCommand

            DataGridView1.DataSource = ANPDt

Your problem is either in line 1

Dim ANPSql As String = "Select * from Table1 limit 0,20"

or in line 14 & 15.

ANPDa.Fill(ANPDs, "ANPDatabase")
ANPDt = ANPDs.Tables("ANPDatabase")

Which is the correct TableName?
SQL Statement's <TableName> and the argument value for <srcTableName> in Fill function and Table property should be the same.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.