0

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
2
Contributors
1
Reply
15
Views
2 Years
Discussion Span
Last Post by Shark_1
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.