0

System.Runtime.InteropServices.COMException: 'Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.'

I am using Microsoft Access to connect at VBNET Studio. In the form, there are no issues but if I run it this quote appears " System.Runtime.InteropServices.COMException: 'Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.'" at the line of "tbl.movefirst()"

here is the code

Public Class Form1
    Public db As New ADODB.Connection
    Public tbl As New ADODB.Recordset

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.TeybolTableAdapter.Fill(Me.DatabaseDataSet.Teybol)
        'db.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & "C:\Users\Windows10\OneDrive\Documents\Database.accdb")
        db.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Windows10\OneDrive\Documents\Database.accdb")
        tbl.Open("select * from Teybol", db, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
        tbl.MoveFirst()

        Call DisplayRecord()
        Call DisabledControl()
    End Sub
Public Class Form1
    Public db As New ADODB.Connection
    Public tbl As New ADODB.Recordset

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.TeybolTableAdapter.Fill(Me.DatabaseDataSet.Teybol)
        'db.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & "C:\Users\Windows10\OneDrive\Documents\Database.accdb")
        db.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Windows10\OneDrive\Documents\Database.accdb")
        tbl.Open("select * from Teybol", db, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
        tbl.MoveFirst()

        Call DisplayRecord()
        Call DisabledControl()
    End Sub
  • The following may be helpful: https://stackoverflow.com/questions/69624053/converting-access-ole-object-image-to-show-in-datagridview-vb-net/69638011#69638011 – Tu deschizi eu inchid Nov 22 '22 at 15:11
  • 1
    Well, the error is reasonably clear to me. the query you're using for tbl is returning no records. That aisde, you're using a mix of old adodb and ado.net methodologies there. Pick one. would suggest the ado.net with TableAdpters etc – Hursey Nov 22 '22 at 20:00

0 Answers0