Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click

    If Me.dgvData.Rows.Count > 0 Then
        If Me.dgvData.SelectedRows.Count > 0 Then
            Dim intPName As Integer = Me.dgvData.SelectedRows(0).Cells("Name").Value
            If Not cnn.State = ConnectionState.Open Then
                cnn.Open()
            End If

            Dim cmd As New OleDb.OleDbCommand
            cmd.Connection = cnn
            cmd.CommandText = "DELETE FROM POS FROM [Name]=@Name" & intPName

            cmd.ExecuteNonQuery() 'syntax error occured here


            Me.RefreshData()


        End If
    End If
End Sub

Private Sub RefreshData()

    If Not cnn.State = ConnectionState.Open Then
        cnn.Open()
    End If
    Dim da As New OleDb.OleDbDataAdapter("SELECT Pname as [Name]," & _
                                         "Pnum as [Number], Qty" & _
                                         " FROM POS ORDER BY Pname", cnn)
    Dim dt As New DataTable

    da.Fill(dt)

    Me.dgvData.DataSource = dt
    cnn.Close()
End Sub

DELETE FROM POS FROM [Name]=@Name - you have FROM in there twice. I think you need a WHERE as well!

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.