i have this problem :
Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information.
...
the button used to delete record in my project is button6 at the end of the code
my code
:

Public Class Form1
    Dim con As New OleDb.OleDbConnection
    Dim dbProvider As String
    Dim dbSource As String
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim sql As String
    Dim inc As Integer
    Dim MaxRows As Integer
   
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = E:/mm.mdb"

        con.ConnectionString = dbProvider & dbSource

        con.Open()
        sql = "SELECT * FROM FirstClass"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "mm")
        MaxRows = ds.Tables("mm").Rows.Count
        inc = -1
        Button3.Enabled = False
        Button1.Enabled = False
        Buttonx.Enabled = True
        Button2.Enabled = True
    End Sub

    Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonx.Click

        If inc <> MaxRows - 1 Then
            inc += 1
            studentname.Text = ds.Tables("mm").Rows(inc).Item("Name")
            phone.Text = ds.Tables("mm").Rows(inc).Item("Phone")
            percent.Text = ds.Tables("mm").Rows(inc).Item("Percentofabsence")
            address.Text = ds.Tables("mm").Rows(inc).Item("Address")
            rate.Text = ds.Tables("mm").Rows(inc).Item("studentrate")
            notes.Text = ds.Tables("mm").Rows(inc).Item("Notes")
            password.Text = ds.Tables("mm").Rows(inc).Item("studentpassword")
            result.Text = ds.Tables("mm").Rows(inc).Item("Monthlyexamsresult")
            If inc > 0 Then
                Button3.Enabled = True
                Button1.Enabled = True
            End If
            If inc = MaxRows - 1 Then
                Buttonx.Enabled = False
                Button2.Enabled = False
            Else
                Buttonx.Enabled = True
                Button2.Enabled = True
            End If
       
        End If
       
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If inc > 0 Then
            Button3.Enabled = True
            Button1.Enabled = True
        End If
        If inc < MaxRows Then
            Buttonx.Enabled = True
            Button2.Enabled = True

        End If
        If inc > 0 Then
            inc -= 1
            If inc > 0 Then
                Button3.Enabled = True
                Button1.Enabled = True
            Else
                Button3.Enabled = False
                Button1.Enabled = False
            End If
            If inc < MaxRows Then
                Buttonx.Enabled = True
                Button2.Enabled = True

            End If
            studentname.Text = ds.Tables("mm").Rows(inc).Item("Name")
            phone.Text = ds.Tables("mm").Rows(inc).Item("Phone")
            percent.Text = ds.Tables("mm").Rows(inc).Item("Percentofabsence")
            address.Text = ds.Tables("mm").Rows(inc).Item("Address")
            rate.Text = ds.Tables("mm").Rows(inc).Item("studentrate")
            notes.Text = ds.Tables("mm").Rows(inc).Item("Notes")
            password.Text = ds.Tables("mm").Rows(inc).Item("studentpassword")
            result.Text = ds.Tables("mm").Rows(inc).Item("Monthlyexamsresult")
            If inc > 0 Then
                Button3.Enabled = True
                Button1.Enabled = True
            End If
            If inc < MaxRows Then
                Buttonx.Enabled = True
                Button2.Enabled = True

            End If
        Else
            MsgBox("No More Rows")
            inc = -1
            Button1.Enabled = False
            Button3.Enabled = False
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Button3.Enabled = False
        Button1.Enabled = False
        Buttonx.Enabled = True
        Button2.Enabled = True

        inc = 0
        studentname.Text = ds.Tables("mm").Rows(inc).Item("Name")
        phone.Text = ds.Tables("mm").Rows(inc).Item("Phone")
        percent.Text = ds.Tables("mm").Rows(inc).Item("Percentofabsence")
        address.Text = ds.Tables("mm").Rows(inc).Item("Address")
        rate.Text = ds.Tables("mm").Rows(inc).Item("studentrate")
        notes.Text = ds.Tables("mm").Rows(inc).Item("Notes")
        password.Text = ds.Tables("mm").Rows(inc).Item("studentpassword")
        result.Text = ds.Tables("mm").Rows(inc).Item("Monthlyexamsresult")
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Button3.Enabled = True
        Button1.Enabled = True
        Buttonx.Enabled = False
        Button2.Enabled = False
        inc = MaxRows - 1
        studentname.Text = ds.Tables("mm").Rows(inc).Item("Name")
        phone.Text = ds.Tables("mm").Rows(inc).Item("Phone")
        percent.Text = ds.Tables("mm").Rows(inc).Item("Percentofabsence")
        address.Text = ds.Tables("mm").Rows(inc).Item("Address")
        rate.Text = ds.Tables("mm").Rows(inc).Item("studentrate")
        notes.Text = ds.Tables("mm").Rows(inc).Item("Notes")
        password.Text = ds.Tables("mm").Rows(inc).Item("studentpassword")
        result.Text = ds.Tables("mm").Rows(inc).Item("Monthlyexamsresult")
        Button2.Enabled = False
        Buttonx.Enabled = False
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim cb As New OleDb.OleDbCommandBuilder(da)
        Dim dsNewRow As DataRow
        dsNewRow = ds.Tables("mm").NewRow()
        dsNewRow.Item("Name") = studentname.Text
        dsNewRow.Item("Phone") = phone.Text
        dsNewRow.Item("Percentofabsence") = percent.Text
        dsNewRow.Item("Address") = address.Text
        dsNewRow.Item("studentrate") = rate.Text
        dsNewRow.Item("Notes") = notes.Text
        dsNewRow.Item("studentpassword") = password.Text
        dsNewRow.Item("Monthlyexamsresult") = result.Text
        ds.Tables("mm").Rows.Add(dsNewRow)
        da.Update(ds, "mm")
        MaxRows += 1
        MsgBox("New Record added to the Database")
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim cb As New OleDb.OleDbCommandBuilder(da)
        ds.Tables("mm").Rows(inc).Item("Name") = studentname.Text
        ds.Tables("mm").Rows(inc).Item("Phone") = phone.Text
        ds.Tables("mm").Rows(inc).Item("Percentofabsence") = percent.Text
        ds.Tables("mm").Rows(inc).Item("Address") = address.Text
        ds.Tables("mm").Rows(inc).Item("studentrate") = rate.Text
        ds.Tables("mm").Rows(inc).Item("Notes") = notes.Text
        ds.Tables("mm").Rows(inc).Item("studentpassword") = password.Text
        ds.Tables("mm").Rows(inc).Item("Monthlyexamsresult") = result.Text
        da.Update(ds, "mm")
        Button3.Enabled = False
        Button1.Enabled = False
        Buttonx.Enabled = True
        Button2.Enabled = True
        MsgBox("This student has been updated")
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        studentname.Clear()
        phone.Clear()
        percent.Clear()
        address.Clear()
        rate.Clear()
        notes.Clear()
        password.Clear()
        result.Clear()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim cb As New OleDb.OleDbCommandBuilder(da)
        
        ds.Tables("mm").Rows(inc).Delete()
        MaxRows = MaxRows - 1
        da.Update(ds, "mm")
        inc = 0
        studentname.Text = ds.Tables("mm").Rows(inc).Item("Name")
        phone.Text = ds.Tables("mm").Rows(inc).Item("Phone")
        percent.Text = ds.Tables("mm").Rows(inc).Item("Percentofabsence")
        address.Text = ds.Tables("mm").Rows(inc).Item("Address")
        rate.Text = ds.Tables("mm").Rows(inc).Item("studentrate")
        notes.Text = ds.Tables("mm").Rows(inc).Item("Notes")
        password.Text = ds.Tables("mm").Rows(inc).Item("studentpassword")
        result.Text = ds.Tables("mm").Rows(inc).Item("Monthlyexamsresult")

    End Sub
End Class

i used tutorial from home and learn website but problems appeared with me with delete and update record from the db

You should make it a rule to include an ID field and make it a Primary Key when creating tables in a database.
And also include that in your SELECT statements.

That's why you get that message.

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.